nmh-workers
[Top] [All Lists]

Re: Solaris 'vim' configure bug

2003-06-02 20:30:11
On 2 June 2003 at 22:13, Glenn Burkhardt <glenn(_at_)aoi-industries(_dot_)com> 
wrote:
  if echo 'r /nonexist-file
q' | ex > /dev/null 2>&1

It seems wrong to me to include a newline in the string this way.  It could be
re-written as:

echo 'r /nonexist-file\nq' | ex > /dev/null 2>&1

Unless I'm missing something, both make exactly the same output:

$ echo 'r /nonexist-file
q' | od -c
0000000   r       /   n   o   n   e   x   i   s   t   -   f   i   l   e
0000020  \n   q  \n
0000023

$ echo 'r /nonexist-file\nq' | od -c
0000000   r       /   n   o   n   e   x   i   s   t   -   f   i   l   e
0000020  \n   q  \n
0000023

And the first one has the advantage that it should work on *all* Bourne
shells and all systems, whether the particular version of echo will
translate \n to a newline or not.

Jerry
-- 
Jerry Peek, jpeek(_at_)jpeek(_dot_)com, http://www.jpeek.com/

<Prev in Thread] Current Thread [Next in Thread>