Common Tasks
- Rename *.foo files to *.bar files: for i in *.foo; do mv $i ${i%.foo}.bar; done (BashFAQ)
- Rename foo.* files to bar.* files: for i in foo.*; do mv $i bar.${i#foo.}; done (also check out the perl regex-based rename Linux utility)
- Do something to multiple arguments: for i in arg1 arg2 arg3; do echo $i; done
- Print 0 through 9 on separate lines: for i in {0..9}; do echo $i; done
- Flatten output onto one line: <Multi-line output> | xargs (10 habits)
- GNU Bash Reference Manual
- Bash Manpage
- BashFaq Bash FAQs and answers
- Bash Pitfalls common mistakes
- Advanced Bash Scripting Guide Everything you would want to know about Bash scripting
- Bash Guide for Beginners A beginner's guide to Bash, some shell examples
- 10 Good UNIX Habits Advanced tips on the command line
No comments:
Post a Comment