I have been working on a script mixture of bash
and python
script. The bash script can receive unknown count input arguments. For example :
tinify.sh test1.jpg test2.jpg test3.jpg .....
After the bash receives all, it pass these arguments to tinify.py
. Now I have come out two ways to do that.
Loop in
bash
and callpython tinify.py testx.jpg
In another word,
python tinify test1.jpg
thenpython tinify test2.jpg
, finalypython tinify test3.jpg
Pass all arguments to
tinify.py
then loop inpython
But there is a problem, I want to filter same parameter for example if user input tinify.sh test1.jpg test1.jpg test1.jpg
, I only want tinify.sh test1.jpg
.So I think it's easier to do in second way because python may be convenient.
How can I do to pass all arguments to python script? Thanks in advance!