How to pass parameters to a Bash script?
You use $1
, $2
in your script. E.g:
date1="$1"
date2="$2"
sed "s/$date1/$date2/g" wlacd_stat.xml >temp.xml
mv temp.xml wlacd_stat.xml
To iterate over the parameters, you can use this shorthand:
#!/bin/bash
for a
do
echo $a
done
This form is the same as for a in "$@"
.