circumflex in character ranges in filename expansion and case statements?

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

 



I just ran into this in a real script.

http://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_13
says that character ranges in filename expansion and case statements
use ! instead of ^, but bash and zsh accept either ! or ^ equally,
whereas dash and ash accept only what the standard demands, !.

e.g.

case x in
[^x]) echo "bug: x is not recognized as being in character range";;
esac

outputs "bug..." on dash (both as shipped in ubuntu 12.04, and from git)
and ash (ubuntu 12.04),
and does not output anything on bash or zsh from ubuntu 12.04.

The conforming script

case x in
[!x]) echo "bug: x is not recognized as being in character range";;
esac

behaves properly in all four shells.

So... I'll fix my script.  But jeez.
--
To unsubscribe from this list: send the line "unsubscribe dash" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux