shell problem

Greg Comeau greg at csanta.UUCP
Tue Apr 5 14:52:11 AEST 1988


>An application I wrote in shell should accept a unix command 
>from a user and execute it. The solution should be:
>	read l
>	exec $l
>My solution was;
>	read l
>	echo $l>tmp$$
>	exec tmp$$

The ls -l should work, but the ls -l;who will not because the ';' is a shell
construct that needs to be intepreted (that is, $l only results in a string,
what you want to do is force the shell to scan the line again after
substitutions).  You can make this happen by using:
        eval $l  (or eval exec $l)



More information about the Comp.unix.xenix mailing list