help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-bash] checking file line: 'commit;'


From: Paolo Supino
Subject: Re: [Help-bash] checking file line: 'commit;'
Date: Thu, 11 Aug 2016 16:34:28 +0200

Hi Chet

thank you for the reply, I tried [ "$string" = 'commit;' ] but it didn't
work :-( and I don't think that case cuts it for my problem.

Maybe it's worth writing what I'm trying to achieve... I have a set of
directories with a lot (10 of thousands) of SQL scripts that I need to
verify that the last statement is 'commit;'...

What I thought of doing was: If while reading a SQL script if it meets
'commit;' remember the line number it found it on (I use readarray/mapfile
and for loop to parse the SQL scripts). Afterwards check if another index
that gets incremented every time there's a SQL statement in the script. If
the second index is bigger than 'commit;' line number point it out...


If anyone has a better solution, I'm willing to read and learn...




TIA
Paolo





On Thu, Aug 11, 2016 at 4:09 PM, Chet Ramey <address@hidden> wrote:

> On 8/11/16 8:59 AM, Paolo Supino wrote:
>
> > Can anyone please help understand how I
> > can check that a string equals to commit;
>
> Something like
>
> case "$string" in
> 'commit;')      ok ;;
> *)              not ok ;;
> esac
>
> or
>
> [ "$string" = 'commit;' ]
>
> --
> ``The lyf so short, the craft so long to lerne.'' - Chaucer
>                  ``Ars longa, vita brevis'' - Hippocrates
> Chet Ramey, UTech, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~
> chet/
>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]