All newlines are removed when saving cat output into a variable
The shell is splitting the msgs variable so echo get multiple parameters. You need to quote your variable to prevent this to happen: echo “$msgs”
The shell is splitting the msgs variable so echo get multiple parameters. You need to quote your variable to prevent this to happen: echo “$msgs”
$ echo “a\nb” a\nb $ echo -e “a\nb” a b
The default shell in Alpine Linux is ash. Ash will only read the /etc/profile and ~/.profile files if it is started as a login shell sh -l. To force Ash to source the /etc/profile or any other script you want upon its invocation as a non login shell, you need to setup an environment variable … Read more
It supports lists, but not as a separate data structure (ignoring arrays for the moment). The for loop iterates over a list (in the generic sense) of white-space separated values, regardless of how that list is created, whether literally: for i in 1 2 3; do echo “$i” done or via parameter expansion: listVar=”1 2 … Read more
These are positional arguments of the script. Executing ./script.sh Hello World Will make $0 = ./script.sh $1 = Hello $2 = World Note If you execute ./script.sh, $0 will give output ./script.sh but if you execute it with bash script.sh it will give output script.sh.