📄️ Bash file test operators
Ref
📄️ Convert string lower-/uppercase
Using tr:
📄️ Copy a whole directory
This is my favourite bash one-liner of all time:
📄️ Echo to STDERR instead of STDOUT
See posting here and the Bash Hackers Illustrated Redirection Tutorial.
📄️ Get lastmod of file
📄️ Increment variable
In Bash there are several ways to achieve this
📄️ Insert text at top of file
Based on this tip, either using sed since it can operate on a line number, in this case "1":
📄️ Output whitepace as control characters
E.g. to show the contents of the special variable IFS
📄️ Populate array from string
According to this posting, given a string delimited with spaces, e.g. `line="0.1 1 two three"`
📄️ Test if directory empty
As explained here
📄️ Uppercase first character
Lifted from this posting, using tr and parameter expansion, this can be achieved thus:
📄️ Use `sed` to insert lines before or after a match
Given a file, FILE, containing this content: