Advertisement
Guest User

Untitled

a guest
Apr 19th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. # Kills a background job when there is only one backgrounded job.
  2. # If there is more than one a message is printed.
  3. #
  4. # Created originally b/c Godot 3.1 does not quit when run from
  5. # command line and it encounters an exception. In this use case
  6. # just press ctrl+z then type kil and Godot goes away
  7. function kil {
  8. local line_count=`jobs | wc -l | tr -d '[:space:]'`
  9. local jobs_text=`jobs`
  10.  
  11. if [ $line_count -eq "1" ];then
  12. local job_num=${jobs_text:1:1}
  13. echo "Killing ${job_num}."
  14. eval "kill -9 %${job_num}"
  15. elif [ $line_count -eq "0" ];then
  16. echo "No jobs, nothing to kil."
  17. else
  18. echo "Too many jobs, not sure which to kil."
  19. echo $jobs_text
  20. fi
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement