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

2 Answers2

0

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

python sortout.py "${var1}" "${var2}"
Oni1
  • 1,445
  • 2
  • 19
  • 39
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

Sanket
  • 744
  • 7
  • 22