I am using
fold
to make an array of characters from a string.
INPUT=$1
arr=($(fold -w1 <<< "$INPUT"))
echo "$arr"
echo "$arr[@]"
I use command ./myProgram 1234
to execute the script.
Expected output: 1 2 3 4
What I get: 1
and 1[@]
Asked by HarshvardhanSharma
(289 rep)
Dec 6, 2018, 05:27 PM
Last activity: Dec 6, 2018, 05:36 PM
Last activity: Dec 6, 2018, 05:36 PM