On Mon, Jan 10, 2005 at 12:32:16PM +0100, Thomas Lange wrote:
>
> I don't understand why this additional patch is needed. I never heard
> of any problems with these lines.
>
I'll try to explain. Perhaps I am wrong.
1) The return issue.
The code uses a construct of the form:
return echo 1
Yet this construct might be specific to your default shell. Here I get:
$ sh
sh-2.05b$ sh --version
GNU bash, version 2.05b.0(1)-release (i386-pc-linux-gnu)
Copyright (C) 2002 Free Software Foundation, Inc.
sh-2.05b$ test1() { echo 1; return; }
sh-2.05b$ test2() { return echo 1; }
sh-2.05b$ test1
1
sh-2.05b$ test2
sh: return: echo: numeric argument required
sh-2.05b$ exit
exit
$ help return
return: return [n]
Causes a function to exit with the return value specified by N. If N
is omitted, the return status is that of the last command.
$
Also note the help states that omitting the return value will make it
return the status of the last command.
2) The return value of grep.
The way I see it, the grep statement is an attempt to verify that the
directories we are interested in are not mentioned in /etc/exports. In
which case the following echo statement will write them there.
Therefore, the following code is a test case:
$ cat example
dir1
dir2
$ grep "^dir1[[:space:]]" example
dir1
$ grep -q '^dir1[[:space:]]' example && echo not found
not found
$
$ # This is obviously wrong. dir1 is mentioned in the file. Now let us
$ # negate the return value of grep:
$
$ ! grep -q '^dir1[[:space:]]' example && echo not found
$
$ # Which is what we want, or so I believe.
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]