Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

bash add multui options to script

#!/bin/bash

while getopts ":a:p:" opt; do
  case $opt in
    a) arg1="$OPTARG"
    ;;
    p) arg2="$OPTARG"
    ;;
    ?) echo "Invalid option -$OPTARG" >&2
    ;;
  esac
done

printf "Argument 1 is %s
" "$arg1"
printf "Argument 2 is %s
" "$arg2"
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #bash #add #multui #options #script
ADD COMMENT
Topic
Name
4+6 =