How to set options for bash script -


this question has answer here:

if have script called program , want set option if -p entered option program echoes "polly want cracker", how should go use getopt this?

i give little example can develop own needs :

#!/bin/bash  while getopts "bp" option     case $option in         b)             echo "polly want banana"             ;;         p)             echo "polly want cracker"             ;;     esac done 

Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -