Search code examples
pythonbashargumentsshquotes

How to edit argument format


I have a python script...it gets called different then bash

./script.py 'arg1' 'arg2 stillarg2'

In the python script there is two arguments.

Now I want to call that with a bash script

#!/bin/bash
./script.py ${1} ${2} ${3}

I want to call the bash script by in this syntax

./script.sh arg1 arg2 stillarg2

In the Bash script there is 3 arguments and no quotes.

So is there a way that by using a bash script, could call the python script with arguments. Without quotes and 3 arguments?.

I've Tried:

#!/bin/bash
./script.py "'${1}'" "'${2} ${3}'"

Outcome is:

operation not support

Solution

  • You just want to combine $2 and $3 in the same argument, no?

    #!/bin/bash
    ./script.py "${1}" "${2} ${3}"