Shell quoting problem. Passing a "?" parameter.
Hulk Hogan
root at lingua.cltr.uq.OZ.AU
Fri May 10 16:28:27 AEST 1991
Hi,
I have a fun menu-based shell for my naive users written in
shell script. I have a problem, in that I have to send in a ? character
to a routine, but am having problems.
Some background. I have a function "do_menu" displays a menu, gets a choice
and then runs that choice. It takes the items on the menu, and the programs
to run as arguments. Some of these programs have arguments, so that I use
double quotes to keep them together.
One of these commands sends in a "?" character as the argument. (It is
called by other menu selections with other characters as argument.)
An equivalent function to demonstrate my problem would be
% sh
$ dm()
{
$*
}
To demonstrate, I use the simple example of dm "echo ?", which just
runs "echo ?". However, I want to get a ? character printed out.
Not the results of explanding the meta-character ?, or the string '?' or
\? or whatever. Just the single character ?. Any ideas?
Here's what I've tried.
$ ls ?
1 4
$ dm "echo ?"
1 4
$ dm 'echo ?'
1 4
$ dm "echo \?"
\?
$ dm 'echo \?'
\?
$ dm "echo '?'"
'?'
$ dm 'echo "?"'
"?"
$
If it's any help, I'm on a SPARC running SunOS 4.0.3. Is this yet another
fixed-in-4.1 sun bug???
/\ndy
--
Andrew M. Jones, Systems Programmer, Internet: andy at lingua.cltr.uq.oz.au
Centre for Lang. Teaching & Research, UUCP: uunet!lingua.cltr.uq.oz.au!andy
University of Queensland, St. Lucia, Phone: +61 7 365 6915 (Use 07 in Oz)
Brisbane, Qld. AUSTRALIA 4072 Fax: +61 7 365 7077 IRC: HulkHogan
"No matter what hits the fan, it's never distributed evenly....."
More information about the Comp.unix.shell
mailing list