Last active
August 29, 2015 14:25
-
-
Save mariolopjr/c6aaa4b99c553bec6916 to your computer and use it in GitHub Desktop.
Alternative `tree`, suing only find and awk
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
#!/bin/bash | |
# | |
# Alternative to `tree`, lists directories/files in current directory | |
# Original credit to jweyrich from Stack Overflow: http://superuser.com/a/409654 | |
# Edited by Mario Lopez | |
# | |
find $1 -print 2>/dev/null | awk '!/\.$/ { \ | |
for (i=1; i<NF; i++) { \ | |
printf("%4s", "|") \ | |
} \ | |
print "-- "$NF \ | |
}' FS='/' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment