Advertisement
triclops200

so supercommand

Nov 5th, 2013
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.44 KB | None | 0 0
  1. so() {
  2.     if [[ "" == "$1" ]]
  3.     then
  4.         ls
  5.     else
  6.         if [[ -d "$1" ]]
  7.         then
  8.             cd "$1"
  9.         else
  10.             kappa=`file -i "$1"`
  11.             if [[ "$kappa" == *text* ]]
  12.             then
  13.                 vim "$1"
  14.             elif [[ "$kappa" == *image* ]]
  15.             then
  16.                 mirage "$1"
  17.             else
  18.                 if [[ "c" == "$1" ]]
  19.                 then
  20.                     clear
  21.                 elif [[ "h" == "$1" ]]
  22.                 then
  23.                     cd ~
  24.                 else
  25.                     echo "I don't know how to handle this situation"
  26.                 fi
  27.             fi
  28.         fi
  29.     fi
  30. }
  31. export so
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement