Mike Stroyan wrote:
> 龙海涛 wrote:
> > Bob Proulx wrote:
> > > test=$(pwd)
> > > echo $test
>
> By the way, the variable "$PWD" has the same current directory value
> as "$(pwd)" .
Yes, you have a point, but... Even though this is a bash list I still
prefer to use standard constructs when poss
> > It's not a bug. the exit status of a command, the "return" of your
> > function, is limited to the numbers 0-255.
>
> It's 0-128, actually.
Whoops, no, you're right. You just can't count on exit statuses
greater than 127 not conflicting with processes exiting due to a
signal, so practice is
> Machine Type: i686-pc-linux-gnu
>
> Bash Version: 3.2
> Patch Level: 0
> Release Status: release
>
> Description:
> history builtin command no reconect stdout if fail:
>
> $ history >new_out bad_argument
> -bash: history: bad_argument: numeric argument required
>
> in
> It's not a bug. the exit status of a command, the "return" of your
> function, is limited to the numbers 0-255.
It's 0-128, actually.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
Live Strong.
Chet Ramey, ITS, CWRU[EMAIL PROTECTED]
Configuration Information [Automatically generated, do not change]:
Machine: i686
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i686'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-pc-linux-gnu' -DCONF_VENDOR='pc'
-DLOCALEDIR='/usr/local/share/locale' -DPACK
On Nov 14, 2007 7:26 AM, naruto canada <[EMAIL PROTECTED]> wrote:
> function fact {
> local n=$1
> if [ "$n" -eq 0 ]; then
> return 1
> else
> fact $(( $n - 1 ))
> return $(( $n * $? ))
> fi
> }
>
> for i in `seq 0 11`; do
> fact $i ; echo $?
> done
>
>
> 1
> 1
> 2
> 6
> 24
> 12
function fact {
local n=$1
if [ "$n" -eq 0 ]; then
return 1
else
fact $(( $n - 1 ))
return $(( $n * $? ))
fi
}
for i in `seq 0 11`; do
fact $i ; echo $?
done
1
1
2
6
24
120
208
176
128
128
0
0
the results are wrong for 6 and above.
is this a bug?
Configuration Information [Automatically generated, do not change]:
Machine: i686
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i686'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-pc-linux-gnu'
-DCONF_VENDOR='pc' -DLOCALEDIR='/usr/local/share/locale' -DPACKA