Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: #! problem
- X-seq: zsh-workers 2797
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxxxxxxxxx>
- To: Peter Stephenson <pws@xxxxxx>, zsh-workers@xxxxxxxxxxxxxxx (Zsh hackers list)
- Subject: Re: #! problem
- Date: Wed, 15 Jan 1997 10:50:34 -0800
- In-reply-to: Peter Stephenson <pws@xxxxxx> "#! problem" (Jan 15, 10:37am)
- References: <199701150937.KAA00978@xxxxxxxxxxxx>
- Reply-to: schaefer@xxxxxxx
On Jan 15, 10:37am, Peter Stephenson wrote:
} Subject: #! problem
}
} Somebody here tried something like:
}
} #!/bin/zsh -f
} # ^^^^empty spaces added here
As opposed to ... full spaces?
} I would think dropping meaningless spaces in an option string
} (i.e. when an option letter is expected) again would be harmless.
} I just want to wait for the waves of protest before trying anything.
I don't think *dropping* them is the right idea; that could be pretty
confusing, couldn't it? I'd say that a space where an option letter
was expected was actually pretty meaning*ful* -- it probably means
that somebody meant to pass two words to the shell, but mistakenly
passed only one.
Possible solutions:
1. Improve the error message.
/bin/zsh: bad option character " " in: -
(There's probably a better improvement.)
2. Stop parsing options at whitespace, and completely ignore it and
all the characters that come after it. I believe BSD 4.2 csh did
this, if I'm remembering correctly my early days of feeling my way
through scripting.
3. As (2), but issue an error if there's anything other than whitespace
in the trailing part. I think this is the most reasonable choice, as
it doesn't silently drop stuff from the #! line (which was mystifying
when it happened in csh, which is why I'm pretty sure I remember it).
4. Assume that if whitespace makes it to the option parser, there were
really supposed to be two arguments, and actually arrange to parse
it that way, i.e. split the word into two at the whitespace. I don't
really think this is a viable solution, not only because it violates
the whole principle of #! lines (one path plus one argument), but
because it also could mean arbitrarily increasing the number of words
in argv. On the other hand, it makes this work as it appears that it
should:
#! /bin/zsh -f -v -x
5. Ignore whitespace only if it's followed by a `-' and ignore that `-'
as well; otherwise act like (2). This also makes "-f -v -x" and the
like work, but doesn't have the other disadvantages of (4). It still
makes zsh a bit mysterious with respect to other programs named on #!
lines, though, so it's probably not something we should do.
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.nbn.com/people/lantern
Messages sorted by:
Reverse Date,
Date,
Thread,
Author