From 17c756971a1e6de2ae9d15c2345e51458afc1659 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Thu, 6 Aug 2015 18:49:02 +0200 Subject: [PATCH] Add a shell suspend function Squashed commit of the following: commit ede9e510751497d61ff0e78fd948e901171cf6f9 Merge: 938da30 239d2a2 Author: Fabian Homborg Date: Thu Aug 6 18:47:43 2015 +0200 Merge branch 'suspend' of https://github.com/mwm/fish-shell into suspend commit 239d2a28e1868577cc193a8825c64c468d83e944 Author: Mike Meyer Date: Thu Aug 6 11:24:32 2015 -0500 Handle interactive & login shells, SHLVL checks, and better message. commit 6334047ebd08b6a7f609bdb232f0dddb569e8a59 Author: Mike Meyer Date: Tue Aug 4 08:53:10 2015 -0500 Add a description to suspend commit 080458b31c47c44823cfc27fc577f68640006407 Author: Mike Meyer Date: Tue Aug 4 07:05:17 2015 -0500 Add a shell suspend function --- share/functions/suspend.fish | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 share/functions/suspend.fish diff --git a/share/functions/suspend.fish b/share/functions/suspend.fish new file mode 100644 index 000000000..72ba10ca9 --- /dev/null +++ b/share/functions/suspend.fish @@ -0,0 +1,18 @@ +# If the user hasn't set it, make sure our test level has a value +if not set -q suspend_minimum_SHLVL + set -g suspend_minimum_SHLVL 3 +end + + +function suspend -d "Suspend the current shell." + if begin contains -- $argv --force + or not status --is-interactive + or begin test $SHLVL -ge $suspend_minimum_SHLVL + and not status --is-login + end + end + kill -STOP %self + else + echo 2>&1 Cannot suspend login shell or SHLVL to low, use --force to force. + end +end