1833896 Members
2153 Online
110063 Solutions
New Discussion

$(variable#pattern)

 
Hanry Zhou
Super Advisor

$(variable#pattern)

"If the pattern matches the begining of the variable's value, delete the shortest part that matches and return the rest".

For the instance of ${path#/*/}, and
path=/home/billr/mem/long.file.name

I know the result would be billr/mem/long.file.name, but why, can you explain to be why in detail?

Thanks,

none
8 REPLIES 8
James R. Ferguson
Acclaimed Contributor

Re: $(variable#pattern)

Hi Hanry:

Here, the "shortest part that matches" is the slash character ("/") followed by any character ("*") and then followed by another slash character. Hence, if you remove "/home/" you have met this criteria, yielding "/billr/mem/long.file.name".

Using "${path#/home/}" would have the same effect here.

Regards!

...JRF...

Paul Anthony Meyers
New Member

Re: $(variable#pattern)

This message has an interesting topic or subject line that might be causing the forums profile page issues. I am doing a reply to test my profile page. If it does not appear, that would explain why James R. Ferguson's profile page is not work. I am sorry for any inconvenience this might cause anyone.

Paul
Pete Randall
Outstanding Contributor

Re: $(variable#pattern)

Interesting theory, Paul. It appears you're right, because now both profiles get 404'd. Be sure to report this to Dan's issues thread, would you please?

http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x9beebfd1b7a7d34cb44054c2be9cf526,00.html


Pete


Pete
Pete Randall
Outstanding Contributor

Re: $(variable#pattern)

Sure enough: mine, too!


Pete


Pete
James R. Ferguson
Acclaimed Contributor

Re: $(variable#pattern)

Hi Paul:

Very interesting observation! I noticed this morning that I could not get to my profile, yet could not find any others with problems (e.g. any "J" user as has happened on other occasions). Your profile is now inaccessible too, so I suspect that you have found the reason. I have an open call with Dan and will foward this information to him with my thanks to you!

p.s. -> Pete Randall's profile cannot be accessed anymore, too, for having posted here :-))

Regards!

...JRF...
Paul Anthony Meyers
New Member

Re: $(variable#pattern)

Dan has fixed things... Thanks for the feedback.
James R. Ferguson
Acclaimed Contributor

Re: $(variable#pattern)

Hi Paul, Pete & Dan:

Thanks to Dan G. the profile access to me, Paul and Pete has been repaired. Paul, you were correct, the special characters in this thread's subject were responsible. Nice catch!

Dan, its always great to have you around.

Regards!

...JRF...
Pete Randall
Outstanding Contributor

Re: $(variable#pattern)

Thanks to Paul, Jim and Dan. Talk about curiosity and the cat. I just couldn't resist seeing for myself!


Pete


Pete