set -euo pipefail
-
set -e The set -e option instructs bash to immediately exit if any command [1] has a non-zero exit status.
-
set -u set -u affects variables. When set, a reference to any variable you haven't previously defined is an error, and causes the program to immediately exit
-
set -o pipefail This setting prevents errors in a pipeline from being masked. If any command in a pipeline fails, that return code will be used as the return code of the whole pipeline. By default, the pipeline's return code is that of the last command
-
https://gist.github.com/mohanpedala/1e2ff5661761d3abd0385e8223e16425
-
https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/
https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#Special-Parameters
Define a place holder with the -I option
echo "this is a basic xargs example" | xargs -I {} echo "you said: {}"
function my_function {
until kubectl get -n kube-system deploy/my_dep ; do
echo "Wait my_dep deployment ..."
sleep 5
done
# Do someting
}
export -f my_function
timeout 20s bash -c my_function