I am new to bash scripts and i tried a bash script, i want to echo the VER when there is an argument called -v after the first argument (-v should not be there at the first argument's position). I tried following script and it didnot work. It would be great if someone guides. Thanks in advance.
#!/bin/bash
VER=1.0
for var in ${@:-1}
do
if [ "$var" = v ]; then
echo $VER
fi
done