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
- Best AI tools for Software Engineers - November 4, 2024
- Installing Jupyter: Get up and running on your computer - November 2, 2024
- An Introduction of SymOps by SymOps.com - October 30, 2024