Re: recursive functions in bash

2007-12-10 Thread Chet Ramey
davedoom wrote: > I am trying to learn to write recursive functions in bash. As one of my > first attempts i wrote this program to emulate the system provided tac > command: > > after playing with it for a good bit, it no longer produces this error > message: > malloc: ../bash/subst.c:4135: asser

Re: recursive functions in bash

2007-11-30 Thread davedoom
This code produces the error message: [EMAIL PROTECTED]:~$ function swap_until_one_left { [[ 0 == $( wc -l $1 ) ]] && echo "empty file" && exit; [[ 1 == $( wc -l $1 ) ]] && cat $1 && exit; [[ 2 == $( wc -l $1 ) ]] && cat <(tail -1 $1) <(head --lines=-1 $1) && return 0; cat <(tail -1 $1) <( swa