Reputation: 13
#/bin/bash
file='abc1'
ln -s $file.grd GGG.grd
TTT >file-out.txt
file='abc2'
ln -s $file.grd GGG.grd
TTT >file-out.txt
In this case, how can I modify the code?
Upvotes: 0
Views: 93
Reputation: 20763
Maybe something like this:
#/bin/bash
for n in 1 2 3
do
file="abc$n"
ln -s $file.grd GGG.grd
TTT >file-out.txt
done
If you print the variable $file in the loop then it is easy to see if it becomes abc1..3
#/bin/bash
for n in 1 2 3
do
file="abc$n"
echo $file
done
And this prints:
abc1
abc2
abc3
Upvotes: 1