Hi folks
I am struggling to pass the value of a variable, to be used as an argument for a number of sequentially called python scripts, themselves called from a bash script. Apologies for the pathname chaos.
Phase 1: reads the case names from a text file, line by line, saving the name to $case
#Determine how many cases were run
cd /Users/stuartmuller/Sort/PhD/'Analytical testing'
j=$(wc -l 'cases.txt' | awk '{print $1'})
IFS=$'\n'
#Copy AN output files for each case from VM to HOST and process
for line in $(cat cases.txt)
do
case=$line
#Copt file from VM to HOST machine
/Library/'Application Support'/'VMware Fusion'/vmrun -T fusion -gu 'Stuart Muller' -gp gandalf copyFileFromGuestToHost /Users/stuartmuller/Documents/'Virtual Machines.localized'/'Windows 7.vmwarevm'/'Windows 7.vmx' 'C:\Program Files\UCR\STANMOD\Projects\3DADE\AN'$case'\CXTFIT.OUT' $scripting'/src/Stu/CXTFIT_'$case'.OUT'
bash StuANoutputPrep.sh $case
done
Phase 2: Call python script
#Read in argument and save to case2
echo case2 = $1
cd $scripting/src/stu
python StuDeleteMultipleLines.py $case2
Phase 3: Run python script using the value of $case2
import sys
case3 = sys.argv[1]
print case3
The printed output for case3 is "sys.argv[1]" - this is not the value of the variable given as the argument (case3=case2=case='some text'), not even the name of the variable as given in the argument (case2 or $case2)
Clearly I am new to this and bumbling me way around in the dark, so any assistance would be awesome :-)