Hi,
Can't you have a pipe in a command string ?
If I try the following I get errors.
Why ?
> cmd="ls -lrt | grep xyz"
> $cmd
|: No such file or directory
grep: No such file or directory
xyx: No such file or directory
Thanks in advance
Hench
Hi,
Can't you have a pipe in a command string ?
If I try the following I get errors.
Why ?
> cmd="ls -lrt | grep xyz"
> $cmd
|: No such file or directory
grep: No such file or directory
xyx: No such file or directory
Thanks in advance
Hench
Use eval:
eval $cmd
Regards
Hi Franklin,
If we make an alias to the same command, it works fine.
alias cmd="ls -al | wc -l"
cmd
Does it mean that alias internally using eval?
Could be, but I'm not sure of that, they are both builtin shell commands.
Regards