This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Change PS1 when running as administrator


On 6/17/2014 9:34 AM, Andrey Repin wrote:

      [[ $(id -G) =~ \b544\b ]]
was suggested (the suggestion used symbolic name instead of a number and
didn't use word boundary). Seems like word boundary is needed, but I
couldn't get this to work. Are the regex boundary matchers not
supported  by bash =~ operator?
I don't think bash equivalent of test implements Perl RE.
Neither the base test implementation, to that extent.

I thought, perhaps incorrectly, that \b has been around forever and is posix.

In any event, looks like

    [[ $(id -G) =~ (^| )544($| ) ]]

would work.

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]