help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: case $var in $list) issue


From: #!microsuxx
Subject: Re: case $var in $list) issue
Date: Fri, 1 Nov 2024 06:00:49 +0100

hi there
i did .. the failing case code
and it still errors out , same error

bash t1 S foo
unknown cmd: S

i expected it to pass , ' S ' is in the checks list

.. if i replace the case with an if [[ ${cmds[$1]} ( in the original longer
code ) it works well

i did try in this ./t1 no space before the $shorts) , still same

when i copypaste it to the terminal
same error

another mistake i did in the first mail was faulty terminal test of the
case functionality
here true

~ $ m=a\|b ; case b in $m) echo ye ; esac
~ $ m=a\|b ; case b in a|b) echo ye ; esac
ye

so vars like a|b dont work ?

extglobs will be next solution when i use case :
seem

shopt -s extglob
m='@(a|b)' ; case b in $m) echo ye ; esac
ye

On Fri, Nov 1, 2024, 03:10 Greg Wooledge <greg@wooledge.org> wrote:

> On Fri, Nov 01, 2024 at 02:55:53 +0100, #!microsuxx wrote:
> > id still want to know why the case failed
>
> Write a script that has ONLY the case command which is "failing".
>
> Show us that script.
>
> Show us the output of that script.
>
> Tell us what you expected the output to be.
>
>

Attachment: t1
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]