Skip to content

Instantly share code, notes, and snippets.

@todgru
Last active December 11, 2015 18:58
Show Gist options
  • Save todgru/4645144 to your computer and use it in GitHub Desktop.
Save todgru/4645144 to your computer and use it in GitHub Desktop.
bash ls directories directory grep sed ls

list only directories names

ls -1F | grep / | sed 's_/$__'
for fn in `ls -1F | grep / | sed 's_/$__'`; do
    echo "the next file is $fn"

done

ls -1F | grep / | sed 's_/$__' | while read line ; do
   echo $line
done

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