shell scripting problems

perryh at pluto.rain.com perryh at pluto.rain.com
Sat Nov 29 00:40:51 PST 2008


> In the shell script, i have a
>   pkg_info -qLx "^$PKG-[0-9,._]+$"
> also tried (-X)tended regex instead of the standard rege(-x).
>
> sh keeps erroring out saying various $" isn't a valid variable
> name ...

Both sh and csh will try to treat $ inside of "" as a variable
reference.  Does it work any better if you enclose the $ in ''
instead?

If you need the first $ to be a variable reference and the second
to be used literally, you may need to do something like

  "^$PKG-[0-9,._]+"'$'


More information about the freebsd-questions mailing list