Does "echo prompt: | tr -d '\012'" always work?

Does "echo prompt: | tr -d '\012'" always work?

Post by Rich Sa » Sat, 12 May 1990 23:52:06

Trying to write shell scripts that are very portable, but that need to
prompt for input, can be a pain.  In particular you usually have to do
one of the following:
        echo -n "Enter host type:"
        echo "Enter host type:\c"

Does anyone know of a system where the following DOES NOT work?
        echo "Enter host type:" | tr -d '\012'

PLEASE DO NOT TELL ME IF IT WORKS.  I only want to know of places
where it doesn't.

Responses to me will be summarized.


Use a domain-based address or give alternate paths, or you may lose out.


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. Redhat 5.0 install problems

3. mount union problem

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

5. (No subject)

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

7. mibiisa

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

9. progname=`$echo "$0" | sed 's%^.*/%%'` bears no result!!!

10. su cellopt -c "sh -c 'LD_LIBRARY_PATH=/usr/lib; echo $LD_LIBRARY_PATH'"

11. : always "Never logged in." and 'hostname login:'

12. Can't get cu "put" and "take" to work