Linux: shell builtin string matching
Posted
by gmatt
on Stack Overflow
See other posts from Stack Overflow
or by gmatt
Published on 2010-04-30T16:39:22Z
Indexed on
2010/04/30
16:47 UTC
Read the original article
Hit count: 302
I am trying to become more familiar with using the builtin string matching stuff available in shells in linux. I came across this guys posting, and he showed an example
a="abc|def"
echo ${a#*|} # will yield "def"
echo ${a%|*} # will yield "abc"
I tried it out and it does what its advertised to do, but I don't understand what the $,{},#,*,|
are doing, I tried looking for some reference online or in the manuals but I couldn't find anything. Can anyone explain to me what's going on here?
© Stack Overflow or respective owner