0

I have a shell script that points to a Python script.

script.sh

#!/bin/bash
python /folder/script.py

The Python script takes an argument, for example script.py -d 20210107

I tried running the shell script with the date parameter like script.sh -d 20210107 but this is not working. Do I need to add something to my shell script to fix this?

mkrieger1
  • 19,194
  • 5
  • 54
  • 65
Avi G
  • 67
  • 7

1 Answers1

2
#!/bin/bash
python /folder/script.py "$@"

Pass arguments from upper script to lower script with $@.

Matt Miguel
  • 1,325
  • 3
  • 6
  • @CharlesDuffy, ok added quotes. – Matt Miguel Jan 11 '21 at 21:53
  • what is the difference between $* and $@ ? – Avi G Jan 11 '21 at 22:13
  • 1
    @AviG The latter correctly preserves inputs that were quoated and have spaces in them. The former basically gives you what you would have had if there the arguments were written with no quoting - so one arument with a space in it could be treated as two arguments. – Matt Miguel Jan 11 '21 at 22:54