0

Every is in the tittle I need to run python script called from a Bash script. In order to make it more 'user friendly' (my colleagues would like to use it). I want to define variable at the top of my code, that can be used by my python code as a sys.argv[], like this:

#!/bin/bash
var1 = "file1 file2 file3"
var2 = "filemod1 filemod2 filemod3"

python sortout.py var1 var2

It appears that it takes me the var1 as a file and it does not replace it by the variable's value.

Many greetings,

Félix

1
  • You want to review both the duplicates; you have two separate errors. Commented Nov 28, 2017 at 12:31

2 Answers 2

0

You have to access to the content of the defined variables, done with the dollar sign.

python sortout.py "${var1}" "${var2}"
Sign up to request clarification or add additional context in comments.

3 Comments

Thank you this works out perfectly
Then accept the answer to symbolize it to other users, please.
Ok done, I didn't figure out how to do it
0

You have to use $ sign for having access to bash variable e.g

>fval=3
>echo $fval
>3

Refer link Bash Variable in case of any detail needed

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.