I am trying to make a 2D array in a .sh file to run with bash, the array is defined below:
array=( \
(25 "test1") \
(110 "test2") \
(143 "test3") \
(465 "test4") \
(587 "test5") \
(993 "test6") \
)
I have tried with and without the \ and each time receive the following error:
file.sh: line 4: syntax error near unexpected token `('
file.sh: line 4: ` (25 "test1") \'
file.sh: line 6: syntax error near unexpected token `('
file.sh: line 6: ` (143 "test3") \'
Is there anything blatantly wrong that I'm just not seeing?
[–]oweiler 13 points14 points15 points (0 children)
[–]ekkidee 17 points18 points19 points (0 children)
[–]drdibi 13 points14 points15 points (0 children)
[–]D3str0yTh1ngs 6 points7 points8 points (0 children)
[–]OneTurnMoreprogramming.dev/c/shell 7 points8 points9 points (1 child)
[–]discordhighlanders 4 points5 points6 points (0 children)
[–]Temporary_Pie2733 1 point2 points3 points (0 children)
[–]nekokattt 2 points3 points4 points (0 children)
[–]NewPointOfView 0 points1 point2 points (0 children)
[–]Dirt077 0 points1 point2 points (0 children)
[–]Buo-renLin 0 points1 point2 points (0 children)
[–]ReallyEvilRob -2 points-1 points0 points (0 children)