I am trying to read command line arguments in bash but I have problems to read on the 10th column Here is my sample script:
#-------------------------------------------------------
#!/bin/bash
an=$2 mn=$4 dy=$6 der=$8 new=$10 sec=(${12} ${13})
echo $an $mn $dy $der $new $sec
#--------------------------------------------------------
I have run the above script "test.sh" as
./test.sh -yr cat -mn Jan -dy tuesday -der tt -new car -sec 001 001
The output is:
cat Jan tuesday tt -yr0 001
But for variable $new ($10) the answer should have been car
but I get -yr0
Any idea why ?
yacob