Skip to content

Instantly share code, notes, and snippets.

@owskio
Last active September 24, 2015 12:27
Show Gist options
  • Save owskio/747492 to your computer and use it in GitHub Desktop.
Save owskio/747492 to your computer and use it in GitHub Desktop.
WhereAmIandWhatsGoingOn
function ?
{
padleft=""; padright=""; title="$(pwd)"
padleftcount="$(( ($COLUMNS - ${#title})/2 ))"
while [ ${#padleft} -lt $padleftcount ] ; do padleft+=" "; done
function progress { echo $((${#padleft} + ${#title} + ${#padright})); }
while [ $(progress) -lt $COLUMNS ] ; do padright+=" " ; done
echo -e "\n\e[1;4;37;40m${padleft}${title}${padright}\e[0m"
ls "$@" && echo "";
}
@owskio
Copy link
Author

owskio commented Dec 19, 2010

This is a simple bash function.
It prints the working directory (pwd) in a nice format.
Then it calls ls to show the pwd's contents.

@owskio
Copy link
Author

owskio commented Dec 19, 2010

I added the ability to pass into ? any ls options using the "$@" on the last line.
Maybe, eventually I will find a way to add the nice formatting on the first line to all directories listed by the -R option to ls.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment