0

Is something like this possible with fish? i.e.

switch $var case a-z do something case "*" do something else end 

case "*"works fine, but case a-zdoesn't trigger. I also tried case [ a-z ] but no joy.

1 Answer 1

1

The fish shell has not, for some reason, implemented character sets. Assuming you're using the latest version, use the string command

if string match --quiet --regex '[a-z]' $var >/dev/null echo $var contains a letter else echo $var has no letters end 

I'm using regex matching due to the minimal glob patterns in fish

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.