I have a python script that takes an argument and return a multiplication. I have this shell script pythoncall.sh:
python /user/mult.py var1
I want to run this for different argument values in a loop: second.sh
for i in 1 2 3
do
var1=$i
./pythoncall.sh
done
but i don't get the result because i don't pass the variable i think. my error is IndexError: list index out of range.
the python script:
import sys
def main(argv):
num1=sys.argv[1]
len1=int(num1)*3
print(len1)
if __name__ == '__main__':
main(sys.argv)