![]() |
Shell Script - Change user & run multiple commands
Hi folks,
(This may be the wrong forum, apologies if it is) I'm writing a shell script where the user needs to be changed half-way through then some commands are run by this user. I can do this for one command (e.g. su - X -c "echo 'stuff'"), but doing this for more than one command is proving to be a problem - how would I do this? Many thanks, Ian |
Have you tried to just separate multiple commands with semi-colon?
Code:
# su - username -c "echo 'stuff'; cd /path/to/dir; pwd; ls" |
| All times are GMT -5. The time now is 04:47 AM. |