1

I have this shell script:

for i in "$@"
do
case $i in
    -l=*|--ddloc=*)
    DDLOC="${i#*=}"
    shift # past argument=value
    ;;
    *)
          # unknown option
    ;;
esac
done

Its working fine as -x=y but i want to be like -x y. What changes will be required here?

tripleee
  • 175,061
  • 34
  • 275
  • 318
Manish Kumar
  • 10,214
  • 25
  • 77
  • 147

1 Answers1

1
for i in "$@"
do
case $i in
    -l=*|--ddloc=*)
    DDLOC="${i#*=}"
    shift # past argument=value
    ;;
    -l|--ddloc)
    shift # past argument
    DDLOC="$1"
    shift # past value
    ;;
    *)
          # unknown option
    ;;
esac
done
jhnc
  • 11,310
  • 1
  • 9
  • 26