PDA

View Full Version : [ubuntu] what does this do



hungerformore
August 21st, 2010, 01:10 AM
what does the following bash script do? ls -R | grep ": $" | sed -e 's/:$//' -e 's[^-][^\/]*\/ / --/ g ' -e ' s /^/ /'-e's/-/|/'

stoimeno
August 23rd, 2010, 12:38 PM
ls -R | grep ':$' | sed -e 's/:$//' -e 's/[^-][^\/]*\/ /--/g' -e 's/^/ /' -e 's/-/|/'
lists all non-hidden subdirectories (except that it replaces the 1st - by |)
a better way:
find . -type d -name '[^.]*' -print | grep -v '[\/][.]'