I am trying to execute the command like this
python train.py --conv-layers [(512, 10, 5), (512, 8, 4)]
but bash swears
-bash: syntax error near unexpected token `('
I need train.py
receive exactly this.
How to accomplish?
I am trying to execute the command like this
python train.py --conv-layers [(512, 10, 5), (512, 8, 4)]
but bash swears
-bash: syntax error near unexpected token `('
I need train.py
receive exactly this.
How to accomplish?
[
, (
and SPC are all special characters in the syntax of the bash
shell. See how the SPC in between python
and train.py
for instance was used to delimit two arguments to pass to /path/to/python
. [
/]
are special as a glob operator, (
, )
are part of many constructs such as func () ...
, <(...)
, (subshell)
, ((arith))
, etc.
To remove their special meaning, you use quoting/escaping. Quoting operators vary between shells. See How to use a special character as a normal one? for details.
In the bash
shell, you can use '...'
, "..."
, $'...'
, and backslash. Here, best with:
python train.py --conv-layers '[(512, 10, 5), (512, 8, 4)]'
If you intend for [(512, 10, 5), (512, 8, 4)]
to be passed as one single argument to /path/to/python
(beside python
, train.py
and --conv-layers
).