![]() |
bash: execute a semicolon separated list of commands within string
Could someone explain this behavior and how to fix it.
Code:
#! /bin/bashCode:
RUN |
Use eval $cmd
The quotes protected the semicolons. |
If you're not married you can have my first born daughter.
Quote:
|
The shell assigned the entire string. Then, when you ran:
$cmd The shell expanded the string, and tries to execute the first word, using the remaining words as arguments. Thus, you get: echo ONE; echo TWO; echo THREE; This occurs because your command is a simple command expansion: man bash: Quote:
|
| All times are GMT -5. The time now is 09:47 AM. |