Skip to content

Instantly share code, notes, and snippets.

@gyu-don
Created September 7, 2018 03:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gyu-don/410f33d155216ef107954f869beffd4a to your computer and use it in GitHub Desktop.
Save gyu-don/410f33d155216ef107954f869beffd4a to your computer and use it in GitHub Desktop.
fish_functions
function c
if test (count $argv) -eq 0
cd
else if test (count $argv) -gt 1
echo "Too many arguments" >&2
else if test -d $argv[1]
cd $argv[1]
else if test ! -e $argv[1]
echo "Not exists" >&2
else if test (head -26 $argv[1] | wc -l) -lt 26
cat $argv[1]
else
less $argv[1]
end
end
function l
if test (count $argv) -eq 0
ls
else if test (count $argv) -gt 1
echo "Too many arguments" >&2
else if test -d $argv[1]
ls $argv[1]
else if test ! -e $argv[1]
echo "Not exists" >&2
else if test (head -26 $argv[1] | wc -l) -lt 26
cat $argv[1]
else
less $argv[1]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment