Created
July 16, 2015 12:58
-
-
Save RobertKielty/4ec37ee80b4e32bf9fff to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
# Iterate over dirs in a directory | |
# ref http://www.tldp.org/LDP/abs/html/parameter-substitution.html for param subs | |
TEST_DIR="/tmp/" | |
for dir in $TEST_DIR*/ ; do | |
echo "Full path : " ${dir} | |
dir=${dir%*/} # remove trailing slash | |
echo "Path minus trailing /" ${dir} | |
echo "Bare directory name" ${dir##*/} # remove everything up to the remaining lash | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment