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

Re: Timing an operation

2007-05-25 Thread Matthew_S
Thanks Paul and Chet; They both do the same thing and that's exactly what I was looking for. Thanks again, Matthew. Chet Ramey wrote: > > Paul Jarc wrote: > >> date1=`perl -e 'print time()'` >> ... >> date2=`perl -e 'print time()'` >> interval=`expr "$date2" - "$date1"` > > This general ap

Re: Timing an operation

2007-05-25 Thread Matthew_S
ms so simple in my head, but I don't know how to execute it... Any help would be greatly appreciated. Thanks Matthew. Matthew_S wrote: > > Thanks Paul and Chet; > > They both do the same thing and that's exactly what I was looking for. > > Thanks again, > >

Taking input line by line from a config file in Bash

2008-01-02 Thread Matthew_S
Hi all and firstly… Happy New Year! It wouldn’t be a New Year without a New Problem though ;-) I’m trying to create a script that will take the input of a config file line by line. Unfortunately, what seems to be happening is that it is taking it though word by word instead? For arguments sake

Re: Taking input line by line from a config file in Bash

2008-01-02 Thread Matthew_S
Hi Bob, Thanks for the quick reply. With the 'while read line', it appears that I don't need to keep track of the line numbers. In fact this below does exactly what I need it to do; cat $File | # Supply input from a file while read line # As you suggested... do echo $line

Re: Taking input line by line from a config file in Bash

2008-01-03 Thread Matthew_S
I see what you're saying. That's interesting about cat, thanks for the heads up. while read line do { echo $line > /dev/null && echo $line "PASSED" || echo $line "FAILED" } >> $RESULTS done < $FILE exit 0 This does

Finding out current inode size

2008-01-03 Thread Matthew_S
I've been trawilng the web trying to find out how to get the current inode size for a file. I now know how to change the max inode size for the system; mkfs -i size=xxx which also begs the question how to find out the current limit of the system. I'm guessing it'll be the default 256 bytes, bu

Re: Taking input line by line from a config file in Bash

2008-01-08 Thread Matthew_S
I'm having a bit of trouble with one of the lines in my config file. 'ls -l | cut -d ' ' -f1' doesn't want to pass through the script. Here's the output; ls -l | cut -d ' ' -f1 ls: |: No such file or directory ls: cut: No such file or directory ls: ': No such file or directory ls: ': No such fi