Re: Timing an operation

2007-05-24 Thread Chet Ramey
Paul Jarc wrote: > date1=`perl -e 'print time()'` > ... > date2=`perl -e 'print time()'` > interval=`expr "$date2" - "$date1"` This general approach can be used without invoking any external programs: date1=$SECONDS ... date2=$SECONDS interval=$(( $date2 - $date1 )) Chet -- ``The lyf so short,

Re: Timing an operation

2007-05-24 Thread Paul Jarc
Matthew_S <[EMAIL PROTECTED]> wrote: > Can i have something like; > > if > difference between dates <5seconds > echo fail > fi date1=`perl -e 'print time()'` ... date2=`perl -e 'print time()'` interval=`expr "$date2" - "$date1"` if test 5 -gt "$interval"; then echo fail fi On some systems, yo

Re: last element of an array

2007-05-24 Thread Poor Yorick
> > > > If there is not currently a friendlier syntax for this, might I suggest: > > > > ${arr[-1]} > > What's wrong with echo [EMAIL PROTECTED]: -1} ? > I assume this syntax is new since 2.05b.01(1), which is what I currently have access to. I did check the latest "what's new" before

Re: last element of an array

2007-05-24 Thread Andreas Schwab
"Poor Yorick" <[EMAIL PROTECTED]> writes: > The syntax I'm currently using to access the last element of an array looks a > little evil: > >>arr=( one two three ) >>echo ${arr[$(([EMAIL PROTECTED]))]} At least you can leave out the $((...)) construct, this is implicit. Andreas. -- Andreas Sch

Re: last element of an array

2007-05-24 Thread Chet Ramey
Poor Yorick wrote: > The syntax I'm currently using to access the last element of an array looks a > little evil: > >> arr=( one two three ) >> echo ${arr[$(([EMAIL PROTECTED]))]} > three > > If there is not currently a friendlier syntax for this, might I suggest: > > ${arr[-1]} What's wrong w

last element of an array

2007-05-24 Thread Poor Yorick
The syntax I'm currently using to access the last element of an array looks a little evil: >arr=( one two three ) >echo ${arr[$(([EMAIL PROTECTED]))]} three If there is not currently a friendlier syntax for this, might I suggest: ${arr[-1]} -- Poor Yorick ___

Timing an operation

2007-05-24 Thread Matthew_S
Hi all, I'm fairly new to Bash so if I appear slow that's the reason ;) I'm trying to write a function that will give me the time it takes to do an operation and then report to a logfile if it passes or fails. What I have so far is; functionName() { echo Timing the function. >> $LOG

ssh timeout

2007-05-24 Thread Lango
Hi, I created a number of scripts that step through a file containing server names. It will then run a command through an ssh session on the remote servers. The list of servers is quite long and often an ssh session cannot be established for one reason or another. I am trying to find a way to def

[Fwd: Re: printf -v variable ignores nullglob]

2007-05-24 Thread Elmar Stellnberger
> printf -v var "%b" @(hugo); echo "x${var}x" x/src/m3/libs/m3core/LINUXLIBC6/*.@(m3|i3|ig|mg)x > set | grep "/src/ezm3/libs/m3core/LINUXLIBC6/*.@(m3|i3|ig|mg)" > alias | grep "/src/ezm3/libs/m3core/LINUXLIBC6/*.@(m3|i3|ig|mg)" > pwd / > dirs / > To me it does strongly look like a memory corru