bash scripting
Bash recipes
Leverage ShellCheck.net and the VS Code Addin
bash scripting
Proper escaping - Everything is a string
Accessing values
Executing a command
Defining variables
Creating and accessing an array in bash
Creating and accessing a hashmap / dict bash
Determine the directory of the script
results in
Span a command across multiple lines
Use a baskslash (\) at the end of the line (no additional whitespace), and preferably indent the next line:
Lambda-style functions in bash
results in
Creating a text file
The cat > x <<-EOF ... EOF syntax allows to create a file in the local directory. Please not that the lines 6 and 7 below (the content) are prefixed with a tabstop (), which does not show up in the actual text file.
base64-encode a text
The command base64 --wrap=0 converts input into a long base64-encoded string without line breaks.
Bash history
Put the following lines in ~/.inputrc:
Last updated