Why doesn't echo "text" 'command' "more text" work?

Why doesn't echo "text" 'command' "more text" work?

Post by Goran Edvardss » Mon, 22 Mar 1993 00:29:46




>I want the computer to tell me how many messages I have in my mailbox
>when I log on.  I wanted to put something like this into my .login
>file but It gives me error messages:

>echo "You have" 'grep Subject: /usr/spool/mail/me | wc -l'
>"messages."
>...
>Thanks

>Stacy

Try:

echo "You have" `grep Subject: /usr/spool/mail/me | wc -l` "messages."
                ^                                        ^
--

 
 
 

Why doesn't echo "text" 'command' "more text" work?

Post by Tim Pier » Mon, 22 Mar 1993 01:38:04



>I want the computer to tell me how many messages I have in my mailbox
>when I log on.  I wanted to put something like this into my .login
>file but It gives me error messages:

>echo "You have" 'grep Subject: /usr/spool/mail/me | wc -l'
>"messages."

Use the backtick mark ` rather than the apostrophe '.

Unsolicited advice:

  * Try using grep '^Subject:' rather than simply grep Subject: --
    it's more accurate.

  * Instead of piping into wc, use grep -c.  It's a shorter command
    and more efficient.

--
____ Tim Pierce                /  ?Usted es la de la tele, eh?  !La madre



 
 
 

Why doesn't echo "text" 'command' "more text" work?

Post by rod adams {alan da wicke » Sun, 21 Mar 1993 20:35:12



>Unsolicited advice:
>   * Try using grep '^Subject:' rather than simply grep Subject: --
>     it's more accurate.

>   * Instead of piping into wc, use grep -c.  It's a shorter command
>     and more efficient.

A more accurate pattern is '^From ' since that is what is used to delimit the
messages.
--

=================================================================

=================================================================

 
 
 

Why doesn't echo "text" 'command' "more text" work?

Post by Clarence Do » Mon, 22 Mar 1993 02:34:38



Quote:> echo "You have" 'grep Subject: /usr/spool/mail/me | wc -l'  "messages."

                  |                                        |
These should be accent grave `, rather than apostrophes '.
Your intentions are good, but your accent is misdirected ;-)

--
---

               ...pyramid!ctnews!tsmiti!dold

 
 
 

1. Why doesn't echo "text" 'command' "more text" work?

                 ^                                        ^
Wrong quotes, should be -
   echo "You have" `grep Subject: /usr/spool/mail/me | wc -l` "messages."
or -
   echo "You have `grep Subject: /usr/spool/mail/me | wc -l` messages."

But, another problem is, if you've no mail, /usr/spool/mail/me does not
exist, leading grep to say:
   grep: can't open /usr/spool/mail/me
Wc will still report 0.

You might try -
   sh -c 'echo "You have `grep 2>/dev/null Subject: /usr/spool/mail/me | wc -l` messages."'

Hope this helps.

2. HelP solaris 7 install

3. Why "ping" can't recognize the "icmp: echo reply" message ?

4. Zlib Patch for Tripwire

5. """"""""My SoundBlast 16 pnp isn't up yet""""""""""""

6. Help with tar

7. 'echo "some text" |read foo' results in empty $foo

8. Anyone know of and email paging program for FreeBSD?

9. WHY 'exec "$REALFILE" ${1+"$@"}'

10. Why my "chmod" command can't change the "/home "

11. GETSERVBYNAME()????????????????????"""""""""""""

12. FTP works, but "ls" or "dir" doesn't ???

13. why doesn't grub's "geometry" command retain setting?