rajeshkumar created the topic: shell script to run x times
Problem:
First i need to cd to this directory $SWDIR/util
Second i need to run the following either 4 times or 20 times
./swadm add_process 1 BG Y
how can i put this in a script
Regards,
Rajesh Kumar
Twitt me @ twitter.com/RajeshKumarIn
rajeshkumar replied the topic: Re:shell script to run x times
Solution
# Change directory
cd $SWDIR/util
# Set the variable n, which should store the number of iterations,
# either to 4 when condition "bla_bla" or else to 20
if bla_bla then
n=4
else
n=20
fi
# loop n times and do something in that loop
# (initialize the variable i with 1, then loop as long as i is
# smaller than or equal the variable n. increase i by 1 on
# every looping)
for (( i=1; i<=$n; i++ ))
do
./swadm add_process 1 BG Y
done
Regards,
Rajesh Kumar
Twitt me @ twitter.com/RajeshKumarIn
- An Introduction of GitLab Duo - December 22, 2024
- Best Hospitals for affordable surgery for medical tourism - December 20, 2024
- Top Global Medical Tourism Companies in the World - December 20, 2024