This question already has an answer here:
I have a file "commands.php" that dynamically generates bash commands. For example, one line is:
# - commands.php
ssh [email protected] echo "text" > file; reboot;
How can I use the output of xargs
to execute these commands... eval, maybe?
cat commands.php | xargs -L 1 -I {} 'eval "$({})"';
bash /path/to/file
? – Patrick Dec 24 '13 at 23:54.sh
file. (I could copy the output to an sh file, but am interested in how to execute each line of a non-sh file – d-_-b Dec 24 '13 at 23:56