Skip to content

Instantly share code, notes, and snippets.

@J-Swift
Created February 11, 2019 04:32
Show Gist options
  • Save J-Swift/889e5255137c1cf10bcb06b5fd428698 to your computer and use it in GitHub Desktop.
Save J-Swift/889e5255137c1cf10bcb06b5fd428698 to your computer and use it in GitHub Desktop.
bash alias to exit if no jobs suspended
function fge() {
# https://unix.stackexchange.com/a/251050
local -r num_suspended=$(jobs -s | wc -l)
if [ $num_suspended -eq 0 ]; then
exit
else
fg
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment