Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Kills a background job when there is only one backgrounded job.
- # If there is more than one a message is printed.
- #
- # Created originally b/c Godot 3.1 does not quit when run from
- # command line and it encounters an exception. In this use case
- # just press ctrl+z then type kil and Godot goes away
- function kil {
- local line_count=`jobs | wc -l | tr -d '[:space:]'`
- local jobs_text=`jobs`
- if [ $line_count -eq "1" ];then
- local job_num=${jobs_text:1:1}
- echo "Killing ${job_num}."
- eval "kill -9 %${job_num}"
- elif [ $line_count -eq "0" ];then
- echo "No jobs, nothing to kil."
- else
- echo "Too many jobs, not sure which to kil."
- echo $jobs_text
- fi
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement