bug-bash
[Top][All Lists]
Advanced

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

help with combining expressions in an if statement


From: Jim
Subject: help with combining expressions in an if statement
Date: Sat, 01 Jan 2005 13:22:09 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.4) Gecko/20030630

Hi,

I am new to bash and am looking for some help. Specifically, I would like to ensure the user supplies two arguments to the shell script - month and year. How should I combine multiple expressions in an if statement?


So far I have the following script :

month=$1
year=$2

if [ -z$month -o -z$year ]; then
        echo "Usage: $0 month year";
        echo "example: date.sh 01 2005";
        exit 1
fi

In other words I want to say if A is true OR B is true then echo output.

How would I do that?

Any help is much appreciated.

Jim





reply via email to

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