[comp.unix.shell] `;` problems in *sh

smoot@roger-rabbit.Berkeley.EDU (Stephen [Steve] R. Smoot) (04/16/91)

Why does:
csh> `echo "ls ; ls"` 
fail?  
(Generates:
     ; not found
     ls not found
)

This happens in every shell I tried.  But doesnt seem like it should fail
according to the csh man pages.

N.B.
csh> `echo "( /bin/ls ; /bin/ls )"` 
also fails.  [(: Command not found.]

-s

dfenyes@thesis1.med.uth.tmc.edu (David Fenyes) (04/16/91)

In article <1991Apr15.212340.13745@agate.berkeley.edu> smoot@cs.berkeley.edu writes:
>Why does:
>csh> `echo "ls ; ls"` 
>fail?  
>(Generates:
>     ; not found
>     ls not found
>)
>

The string returned by `` is interpreted as:

"ls" ";" "ls".  This makes ';' and 'ls' args to  /bin/ls.

Variable and command substitution should work within the quotes,
but shell special characters will not be recognized.

try

eval `echo "ls ; ls"`

and it will work as you desire.

--
David Fenyes                                 dfenyes@thesis1.hsch.utexas.edu
University of Texas Medical School           Houston, Texas