Sample Header Ad - 728x90

Bash: I have a variable in bash script;

-1 votes
1 answer
72 views
I have a variable in bash script dirs= "4"; I want to get this number from another file so I am using a command dirs= sed -n '1p' < test.txt; It gets me the number, I see it in the terminal. But Later in the code, I want to use a loop for dir in dirs.. it does not work because in the script it does not understand that dir is number. d= sed -n '1p' < test.txt for dirs in $d do echo "$dirs" done dirs= read $dirs speeds= sed -n '2p' < test.txt for speeds in $s do echo "$speeds" done for dir in $dirs do for speed in $speeds do echo "speed=$speed dir=$dir" done done
Asked by Green (15 rep)
Apr 10, 2019, 03:05 PM
Last activity: Apr 10, 2019, 03:15 PM