* /bin/sh bug? "$#" in function never zero?
@ 2002-05-14 2:55 Steven M. Schweda
0 siblings, 0 replies; only message in thread
From: Steven M. Schweda @ 2002-05-14 2:55 UTC (permalink / raw)
% cat arg.sh
#!/bin/sh
echo " argc = $#."
echo " \$1 = >$1<."
p_a()
{
echo " p_a. argc = $#."
echo " p_a. \$1 = >$1<."
}
p_a "$@"
Now, on Solaris (SunOS 4.1.4 or 5.7):
% ./arg.sh
argc = 0.
$1 = ><.
p_a. argc = 0.
p_a. $1 = ><.
While on Tru64 (5.1A):
% uname -a
OSF1 pxp.provis.com V5.1 1885 alpha
% ./arg.sh
argc = 0. <-----+
$1 = ><. |
p_a. argc = 1. <-----+
p_a. $1 = ><.
Add an argument, and all the zeros turn to ones, as expected. This
quirk upsets some scripts I'd prefer not to have to change. Any wisdom?
------------------------------------------------------------------------
Steven M. Schweda (+1) 651-699-9818 (voice, home)
382 South Warwick Street (+1) 763-781-0308 (voice, work)
Saint Paul MN 55105-2547 (+1) 763-781-0309 (facsimile, work)
sms@antinode.org sms@provis.com (work)
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2002-05-14 2:55 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-05-14 2:55 /bin/sh bug? "$#" in function never zero? Steven M. Schweda
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox