Skip to content

Instantly share code, notes, and snippets.

@malikbenkirane
Created July 9, 2018 12:26
Show Gist options
  • Save malikbenkirane/41c3d5e35a5200762b0263822d6549e8 to your computer and use it in GitHub Desktop.
Save malikbenkirane/41c3d5e35a5200762b0263822d6549e8 to your computer and use it in GitHub Desktop.
script that wraps screen command with a fish shell (fish function)
# screen wrapper
function screen
# TODO port: bass source $SOURCMEPATH/screen.sh \; screen $argv
if [ (count $argv) -eq 0 ]; or [ "$argv" = "ls" ]
command screen -ls\
| head -n -1 | tail -n +2\
| awk -F'.' '{print $2}'\
| sed 's/\s*(Attached)/*/' | sed 's/\s*(Detached)//'
else if [ (count $argv) -eq 1 ]
if command screen -rd "$argv"
return
else
echo New screen session
command screen -S "$argv"
end
else
command screen $argv
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment