[prog] shell script

Conor Daly conor.daly-linuxchix at cod.homelinux.org
Fri Jun 22 13:37:47 UTC 2007

On Thu, Jun 21, 2007 at 06:37:16PM -0700 or so it is rumoured hereabouts, 
Diana Ionescu thought:
> Hi there,
> Here is one of my questions that I don't have an answer for ... yet... and one of the "dumb questions"...
> I do have a solution - a C code written by my hubby, but I want my own :-))
> So... what I'm trying to do is: operate operation "bin_op" on two files which are listed in my LIST_i and LIST_j as rows.
> I'm getting the "name" of the file and the extensions (ex file name: 133012.fts - hhmmss.fts) and I want bin_op on the same row in both files, without 59 unnecessary files that are coming out from my script below.
> But if the difference between the times is -1 or 59 I don't want to do this difference.
> So I need a condition for "FOR"  not to go intro a double cycle or a condition on if to constrain all the unnecessary operations.
> For the moment I would be happy with the script below, IF dif=a-b would give me a number. As it is, a and b are just characters and a-b just prints 30-31 and dos not *do* 30-31=-1
>     a=$ATR_i
>     b=$ATR_j
>     dif=a-b

dif=$(( $a - $b )) 

should give you a number in $dif

if [ $dif -eq -1 ]; then

will do the test.

Conor Daly <conor.daly at cod.homelinux.org>
Version: 3.1
GCS/G/S/O d+(-) s:+ a+ C++(+) UL++++ US++ P>++ L+++>++++ E--- W++ !N
PS+ PE Y+ PGP? tv(-) b+++(+) G e+++(*) h-- r+++ z++++ 
http://www.geekcode.com/ http://www.ebb.org/ungeek/

More information about the Programming mailing list