Re: Mass bugfiling potential: 'rules' with space
On 2002.10.11 10:08 Nathan Hawkins wrote:
[...]
> 2. Survey a handful of other Unices. I'd suggest checking OpenBSD,
> Solaris, AIX, HPUX, etc. as many as can be arranged. (I know there are
> people on this list with access to some of these systems.) It would be
> useful to know if Linux or NetBSD behaviour is common. And helpful in
> determining the right thing to do about it.
>
> It'd be nice to able to say: Everything but NetBSD does it this way,
> rather than, this problem breaks some files from Linux.
I tried on a Sun with a slightly different program:
$ uname -a
SunOS unix14.andrew.cmu.edu 5.8 Generic_108528-15 sun4u sparc SUNW,Ultra-60
$ for f in test*; do echo $f':'; cat $f; done
test.c:
int main(int argc, char* argv[])
{
int i;
for (i=0; i<argc; i++)
printf("argv[%i]: \"%s\"\n", i, argv[i]);
}
test.sh:
#!/afs/andrew.cmu.edu/usr1/aij/a.out abc
test2.sh:
#!/afs/andrew.cmu.edu/usr1/aij/a.out a b c
test3.sh:
#!/afs/andrew.cmu.edu/usr1/aij/a.out a b c
(Unless something removes them, you should get spaces at the ends)
$ ./test.sh
argv[0]: "/afs/andrew.cmu.edu/usr1/aij/a.out"
argv[1]: "abc"
argv[2]: "./test.sh"
$ ./test2.sh
argv[0]: "/afs/andrew.cmu.edu/usr1/aij/a.out"
argv[1]: "a"
argv[2]: "./test2.sh"
$ ./test3.sh
argv[0]: "/afs/andrew.cmu.edu/usr1/aij/a.out"
argv[1]: "a"
argv[2]: "./test3.sh"
The funny thing is that on Linux test2 and 3 look like this:
$ ./test2.sh
argv[0]: "/afs/andrew.cmu.edu/usr1/aij/a.out"
argv[1]: "a b c"
argv[2]: "./test2.sh"
Sun ignores everythin after the first word, while Linux groups it into one arg removing the trailing whitespace.
Tomorrow I could try on IRIX and posibly others.
Reply to: