[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Variable getopts lost
From: |
Ken Irving |
Subject: |
Re: Variable getopts lost |
Date: |
Tue, 23 Feb 2010 10:53:46 -0900 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
On Tue, Feb 23, 2010 at 08:30:16PM +0100, Daniel Bunzendahl wrote:
> ...
> if [ !$LSEITE ]; then
> LSEITE=$(pdfinfo $pdf | grep Pages: | sed -e 's/Pages:[[:space:]]//g')
> echo "-l automatisch auf $LSEITE gesetzt"
> fi
> ...
>
> In the last if-loop LSEITE will be set if LSEITE isn't set.
> This is for no parameters on command-line.
> But how I wrote: It ever works.... but now it lost the -l 104 ... the -f is
> no
> Problem...
>
> My question wasn't fokused on my wrong script. I think there is something
> wrong or limited by the System...
> Maybe you can give me a tip I should search for...
>
> Thanks a lot
> Daniel :-)
Note that 'if [ !$LSEITE ]' becomes 'if [ ! ]' if LSEITE is not set, and
the value is true. Maybe that's what you want, but a better way is to use
the -n or -z test operators and to *quote the variable expansion*, e.g.,
if [ -z "$LSEITE" ]; then ...
Unquoted variables expand to nothing, and are evaluated as such.
Perhaps there are other such cases in your script?
Ken