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.
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
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