akoimeexx

ll bash function, replaces ll alias

Jun 18th, 2012
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.60 KB | None | 0 0
  1. # Custom directory listing function for great justice and my own amusement.
  2. function ll () {
  3.     # Suss out the directory we're trying to list
  4.     if [ -d ${@:-1} ]
  5.         then location=${@:-1}
  6.         else location=`pwd`
  7.     fi
  8.     # Put together our directory listing, with custom headers.
  9.     # Include additional arguments passed in from the function call.
  10.     # Pipe the output through more
  11.     {
  12.         printf '\x1b\x5b34m<index \x1b\x5b32mlocation\x1b\x5b35m=\x1b\x5b33m\"%s\"\x1b\x5b34m>\x1b\x5b00m\n' $location &&
  13.         ls -FGhlpv --group-directories-first --color=always $@ &&
  14.         printf '\x1b\x5b34m</index>\x1b\x5b00m\n';
  15.     } |more
  16. }
Advertisement
Add Comment
Please, Sign In to add comment