Skip to content

Instantly share code, notes, and snippets.

@dedeibel
Created September 4, 2014 12:25
Show Gist options
  • Save dedeibel/e94ef4ad9cf708623391 to your computer and use it in GitHub Desktop.
Save dedeibel/e94ef4ad9cf708623391 to your computer and use it in GitHub Desktop.
Run all the given commands separated by terminal ;
#!/bin/sh
COMMAND=""
for arg in $@; do
if [ "$arg" = ";" ]; then
$COMMAND
COMMAND=""
else
COMMAND="$COMMAND $arg"
fi
done
if [ -n "$COMMAND" ]; then
$COMMAND
fi
#
# Useful when you want to pass multiple command to another shell command for execution, for
# example when watching for file changes (watch_file_changes is some inotify watch command)
#
# watch_file_changes DIR command*
# watch_file_changes dir_to_watch doall synch_to_remote \; display_growl_notification \; aplay /usr/share/psi/sound/send.wav
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment