Wednesday, February 1, 2012

Running Commands in a Sub-shell

Content is from this post

Here is how to run "/bin/script.sh" inside "/workingdir" without changing your current path.
(cd /workingdir; /bin/script.sh)

Here is how to run sequence of commands with checking status after each command by inserting "&&"
(cd /workingdir && /bin/script.sh)

Memory is better managed by using "exec" command.
(cd /workingdir && exec /bin/script.sh)

No comments:

Post a Comment