I have a script in bash which basically creates a user and install all the necessary applications.
It works the way that it iterates through a couple of commands, where I put a variable at the end of the command (positional argument).
I've set it up this way
function Install
{
COMMANDS=(
"Do_1st_thing $1"
"Do_2nd_thing $1"
"Do_3rd_thing $1"
)
for CMD in "${COMMANDS[@]}" ; do
$CMD
done
}
Then I run it
Install first_argument
The problem is that the first command is successful, however every next command says "Command not found".
Does the first positional argument ($1) changes after the execution of the first command? Would I have to "eval" the "$CMD" in the "for loop" to get it working?
Feel free to ask any question, I will do my best to answer them.
Thank you for your help, Kris