unix - Update Python Variables via Shell Script -
i have shell script executes 2 python scripts in order. after shell script has executes, need manually go python script , update 2 variables. i'm hoping automate portion in shell script, not sure start.
basically, i'm wondering if can pass (and increment on each run) shell variables python script.
shell
#!/bin/sh echo "download data" python /download.py wait echo "process data" python /process.py
python download
import downloadfunction downloadfunction.donwload('2014-03-28')
python process
import processdata processdata.process(data)
essentially, want increment date via shell script let's 5 times.
so in python script define date variable.
python download
import downloadfunction date = '2014-03-28' downloadfunction.donwload(date)
then each time shell script runs download.py , process.py, want add day date - let's 5 days. i'm not sure start on this.
you want pass date script argument, not edit hard-coded value.
in download.py
:
import downloadfunction date = sys.argv[1] downloadfunction.donwload(date)
then in shell script, like
#!/bin/sh echo "download data" d in 2014-03-28 2014-03-29 2014-03-30 2014-03-31 2014-04-01; python /download.py "$d" done # no need call wait here echo "process data" python /process.py
Comments
Post a Comment