Shell METACHAR's in parameters
Kris Stephens [Hail Eris!]
krs at uts.amdahl.com
Thu Jan 24 11:55:20 AEST 1991
In article <1991Jan23.045104.5557 at NCoast.ORG> allbery at ncoast.ORG (Brandon S. Allbery KB8JRR) writes:
>As quoted from <11k701EV0dwd00 at amdahl.uts.amdahl.com> by krs at uts.amdahl.com (Kris Stephens [Hail Eris!]):
>+---------------
>| In article <829 at marvin.jpl.oz> david at marvin.jpl.oz (David Magnay) writes:
>| >Can anyone supply a "rule" of how to consistently handle shell parameters inside
>| >a script, when the parameter MAY contain shell meta-characters or a regular
>| >expression. The danger is that the shell is will process the characters, rather
>| >than pass them literally.
>|
>| set -f
>| grep $re somefile
>| set +f
>+---------------
>
>Still unsafe --- "set -f" in ksh doesn't stop it from splitting at spaces.
>What happens if the value of $re is "x y"?
Absolutely correct. I *hate* it when things like that slip my mind.
...Kris
--
Kristopher Stephens, | (408-746-6047) | krs at uts.amdahl.com | KC6DFS
Amdahl Corporation | | |
[The opinions expressed above are mine, solely, and do not ]
[necessarily reflect the opinions or policies of Amdahl Corp. ]
More information about the Comp.unix.shell
mailing list