[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Handling getopt for option without optional argument value
From: |
Lawrence Velázquez |
Subject: |
Re: Handling getopt for option without optional argument value |
Date: |
Fri, 23 Jul 2021 16:02:08 -0400 |
User-agent: |
Cyrus-JMAP/3.5.0-alpha0-540-g21c5be8f1e-fm-20210722.001-g21c5be8f |
Returning to the original question.
On Fri, Jul 23, 2021, at 10:22 AM, lisa-asket@perso.be wrote:
> I have the following bash function but when I call it with
>
> indus-printf-multiple -- "Test" "TNest"
>
> the variable $warn is not being set to 1.
>
> [...]
>
> ("-w"|"--warning")
> case "$2" in
> (+([[:digit:]]))
> local warn="$2"
> shift 2
> ;;
> (*)
> local warn="1"
> shift 2
> ;;
> esac
> declare -i local f=1
> ;;
It looks like you only set "warn" when a '-w' or '--warning' option
is present, but nothing you've shown us indicates that you're passing
such an option. So why should "warn" be set at all?
--
vq
- Re: Handling getopt for option without optional argument value, (continued)
- Re: Handling getopt for option without optional argument value, Greg Wooledge, 2021/07/23
- Handling getopt for option without optional argument value, lisa-asket, 2021/07/23
- Re: Handling getopt for option without optional argument value, Dennis Williamson, 2021/07/23
- Handling getopt for option without optional argument value, lisa-asket, 2021/07/23
- Re: Handling getopt for option without optional argument value, Greg Wooledge, 2021/07/23
- Handling getopt for option without optional argument value, lisa-asket, 2021/07/23
- Re: Handling getopt for option without optional argument value, Chet Ramey, 2021/07/23
- Handling getopt for option without optional argument value, lisa-asket, 2021/07/23
- Re: Handling getopt for option without optional argument value, Greg Wooledge, 2021/07/23
- Handling getopt for option without optional argument value, lisa-asket, 2021/07/23
Re: Handling getopt for option without optional argument value,
Lawrence Velázquez <=
Handling getopt for option without optional argument value, lisa-asket, 2021/07/23