Last active
September 24, 2015 12:27
-
-
Save owskio/747492 to your computer and use it in GitHub Desktop.
WhereAmIandWhatsGoingOn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 ""; | |
} |
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
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.