Split string into multiple variables in Bash [duplicate]

Try this: mystring=”192.168.1.1,UPDOWN,Line protocol on Interface GigabitEthernet1/0/13, changed state to up” IFS=’,’ read -a myarray <<< “$mystring” echo “IP: ${myarray[0]}” echo “STATUS: ${myarray[3]}” In this script ${myarray[0]} refers to the first field in the comma-separated string, ${myarray[1]} refers to the second field in the comma-separated string, etc.

Linode Lish bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)

Trial & error with different answers, I came up with this solution (on Lish while server is in rescue-mode): echo “LC_ALL=en_US.UTF-8” >> /etc/environment echo “en_US.UTF-8 UTF-8” >> /etc/locale.gen echo “LANG=en_US.UTF-8” > /etc/locale.conf locale-gen en_US.UTF-8 Last command resulted in the following error: locale-gen: command not found Here’s what you need to do (still on Lish): apt-get … Read more