Linux tips and tricks
- POST
This post list a few tips that I discovered when I started working back in 2013. I have improved my knowledge a great deal over the last years but the information there can still be useful.
Bash (any) Use a default value if the variable is unset or null (see more on parameter expansion):
echo "${TEST:-default}" Transfer the parameters to a command:
test.sh: my_function "$@" test.sh "this has spaces" 25 => my_function will correctly receive 2 parameters: "this has spaces" and 25.