This script has to run 4 times and change its path accordingly. But only Name changes 4 times and path remains the same. Any idea what is wrong with the script? I'm new to bash.
#!bin/bash
File=/tmp/tmp.txt
NAME=(NAME1 NAME2 NAME3 NAME4)
DIR=(/home/path1 /home/path2 /home/path3 /home/path4)
for NAME in "${NAME[@]}"
do
/sbin/myprogram start --read $FILE --path $DIR --name $NAME
done;
In General, I'm trying to automate this command:
/sbin/myprogram start --read /tmp/tmp.txt --path /home/path1 --name NAME1
/sbin/myprogram start --read /tmp/tmp.txt --path /home/path2 --name NAME2
/sbin/myprogram start --read /tmp/tmp.txt --path /home/path3 --name NAME3
/sbin/myprogram start --read /tmp/tmp.txt --path /home/path4 --name NAME4
Can we modify the script to start as
for FILE in /tmp/txt
and then read NAME and Dir separately every time?
I don't want to put this directly in script because there might be more path, name and even there might be more than one txt.