I need this all the time. Thank you so much
We were unable to load Disqus. If you are a moderator please see our troubleshooting guide.
Recommending means this is a discussion worth sharing. It gets shared to your followers' Disqus feeds, and gives the creator kudos!
[ condition ] is an external program naned "[" which is a symbolic link to test.
[[ condition ]] is a bash condition
Thanks - great cheat sheet. Perhaps include some handy filesystem 1-liner examples?
for F in *.txt; do echo "$F" >> files.list; done
Or, the more capable, recursive:
IFS=$'\n'; for F in `find . -type f -name "*.txt"`; do echo "$F"; echo "Second action $F"; done
Simpler, recursive, single action:
find . -type f -name "*.txt"` -exec echo '{}' \;
I know "find" isn't a bash feature - but it sure is a handy command to be aware of.