I have a question of how to run commands from a variable where there are more than one commands in the variable under bash.
I ran the following commands under bash
> command="ls /etc/zshrc; ls /etc/zshenv"
> $command
The results were:
ls: /etc/zshrc;: No such file or directory
ls: ls: No such file or directory
/etc/zshenv
But, when I ran this command:
> eval "$command"
The command yielded the right results:
/etc/zshrc
/etc/zshenv
Why $command didn't work?
Thanks.