mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-03-25 12:45:14 +08:00
Add a shell suspend function
Squashed commit of the following: commit ede9e510751497d61ff0e78fd948e901171cf6f9 Merge: 938da30 239d2a2 Author: Fabian Homborg <FHomborg@gmail.com> 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 <mwm@mired.org> Date: Thu Aug 6 11:24:32 2015 -0500 Handle interactive & login shells, SHLVL checks, and better message. commit 6334047ebd08b6a7f609bdb232f0dddb569e8a59 Author: Mike Meyer <mwm@mired.org> Date: Tue Aug 4 08:53:10 2015 -0500 Add a description to suspend commit 080458b31c47c44823cfc27fc577f68640006407 Author: Mike Meyer <mwm@mired.org> Date: Tue Aug 4 07:05:17 2015 -0500 Add a shell suspend function
This commit is contained in:
parent
f71e877f18
commit
17c756971a
18
share/functions/suspend.fish
Normal file
18
share/functions/suspend.fish
Normal file
@ -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
|
Loading…
x
Reference in New Issue
Block a user