Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a shell suspend function #2269

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 18 additions & 0 deletions 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