I'm approaching to bash script and I need your help.
I did a bash script in which there are different cmd lines. In this script there are some variables (in general path where find files or variable to define file name). All this variables are bind each others but they referred to three main starting variable. In general when I run this script I change in the file these 3 as needed, save and run the script. I would like to not change the variable within the file eachtime but running the script giving in the shell with the cmd line to execute the script also 3 different flag to indicate these 3 variable. How I can modify, and run the script to do this?
This is the script, is not important what it does, but could be useful to explain better my request
myscript.sh
Protein="XXX"
Set="AAAA"
StrID="nnn"
soft="/home/mysoftwarecentos7"
MainDir="/home/$Protein/$Set/$StrID"
DirXray="$MainDir/Xray_$StrID"
Calcolo
mkdir "$MainDir"/"APO_${StrID}ray2"
cd "$MainDir"/"APO${StrID}ray2"
LD_LIBRARY_PATH="$soft"/ "$soft"/ext -w-auto -i "$DirXray"/"${Protein}${StrID}.pdb" -x "APO_${StrID}.pdb" -f "$DirXray"/L_1.pdb
cp ./"APO_${StrID}2_COMPLEX.pdb" "$DirXray"/ sh /home/Script/replaceString Fe C "$DirXray"/"APO${StrID}_2.pdb"
cd ..
echo "Calcolo"
mkdir $MainDir/"Results_${StrID}"
Dir2="$MainDir/X_$StrID/single"
DirResult="$MainDir/Results_$StrID"
cd $MainDir/"AAA_${StrID}"
for dir in *
do
cd "$dir"
LD_LIBRARY_PATH="$soft"/ "$soft"/ext2 -tr "$DirMol2"/"$dir.mol2" -f "$DirXray"/"${Protein}_${StrID}.pdb" -score -opt -save-
cp "${Dir2}"/"$dir.sdf" "$DirResult"/
cp Delta.pdb "$DirResult"/
mv "$DirResult"/Delta.pdb "$DirResult"/"${dir}_Delta.pdb"
cd ..
done
echo "Calcolo_DDG"
When I run this script I change any time variables Protein, Structure, StrID in the file and after in bash shell I execute the script: bash myscript.sh
I'd like to run my script with sometghing like this:
bash myscript.sh XXX AAAA nnn
Where 3 more flags defined the first 3 variables in such a way I don't modify each time the script inside. How can I modify the script to do this?
Thanks.