Issue
I'm trying to split a line with multiple ' in it, but the result are numbers, not strings, trying to get the 1st occurrence of ', I mean the string YouTube down there:
line="application: label='YouTube' icon='res/uFR.xml'"
echo $line
IFS="'"
read -a stringArray <<< "$line"
echo "${stringArray[1]}"
Current Output:
112
Expected Output:
YouTube
Solution
Can you believe this guys ?! It should be capital A, not small a, must be Bash magic :)
read -A stringArray <<< "$line"
Answered By - captain_majid
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.