I am attempting to write a bash script that loops exactly 20 times and then appends each number in the loop to the variable with a string "group". The output of each variable should be group1, group2, group3, and so on. Unfortunately i am unable to get this to work. Here is my code thus far:
#!/bin/bash
USERNUM=0
USERPREFIX='group'
for (( i = 1 ; i <= 20; i++ ))
do
USERNUM=$(($USERNUM+1))
USERCREATE=$(($USERPREFIX+$USERNUM))
echo $USERCREATE
done
I am trying to run this script under OSX 10.6. Any help is greatly appreciated.
USERCREATE="$USERPREFIX$USERNUM"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With