If test problem

Sharky Forums


Results 1 to 2 of 2

Thread: If test problem

  1. #1
    Catfish D@7@K|N&'s Avatar
    Join Date
    Jul 2002
    Location
    In the corners of my mind....
    Posts
    157

    If test problem

    Hey guys....

    I'm having a problem with a script that I wrote. The problem that I'm having is with the 'if' test. Here's the code...

    Code:
    echo "Enter data."
    read variable
    if [-z $variable]
    then
    	echo "Please restart script and enter variable when asked."
    	exit
    else
            ...else stuff...
    fi
    I get an error that looks like this:
    Code:
    ./fw-calc: [-z: not found
    I've tried several different ways and all come out with basically the same result. I want the logic to read as follows...

    Code:
    if variable is null
    then
         ...variable null code...
    else
         ...variable NOT null code...
    fi
    Any help would be appreciated. Thanks.
    OC Crusader

    "I believe that the moment is near when by a procedure of active paranoiac thought, it will be possible to systematize confusion to the total discrediting of the world of reality"
    -Salvador Dali

    ....We are the music makers, and we are the dreamers of dreams... - Willy Wonka

    AMD XP1600+ @1790MHz and rethinking my cooling....
    MAZE3 --> DD Cooler Cube --> Eheim 1048
    512MB PC2700 DDR
    MSI KT3 Ultra-ARU
    2x 20GB Maxtor in RAID 0
    1x 30GB Maxtor --> WinXP
    GF3 Ti200 @ 240/499

  2. #2
    Catfish D@7@K|N&'s Avatar
    Join Date
    Jul 2002
    Location
    In the corners of my mind....
    Posts
    157
    Oh, this is in Solaris 8 BTW if that helps.
    OC Crusader

    "I believe that the moment is near when by a procedure of active paranoiac thought, it will be possible to systematize confusion to the total discrediting of the world of reality"
    -Salvador Dali

    ....We are the music makers, and we are the dreamers of dreams... - Willy Wonka

    AMD XP1600+ @1790MHz and rethinking my cooling....
    MAZE3 --> DD Cooler Cube --> Eheim 1048
    512MB PC2700 DDR
    MSI KT3 Ultra-ARU
    2x 20GB Maxtor in RAID 0
    1x 30GB Maxtor --> WinXP
    GF3 Ti200 @ 240/499

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •