Unix/Linux Go Back    

Shell Programming and Scripting BSD, Linux, and UNIX shell scripting — Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here.

How to write an OR statement

Shell Programming and Scripting

Thread Tools Search this Thread Display Modes
Old Unix and Linux 11-08-2005
aukequist aukequist is offline
Registered User
Join Date: Nov 2005
Last Activity: 27 June 2006, 8:28 AM EDT
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
How to write an OR statement

Hi all,
I want to check if the first or the second or the third argument of call to a shell script is empty.

How do i do that in a short way. I watched some examples and i believe
if [ .$1 = . ] checks if an argument is NULL.

If so, how can i add the checks for argument 2 and 3 in the statement?

Thanks in advance
Auke Quist
Sponsored Links
Old Unix and Linux 11-08-2005
RTM's Unix or Linux Image
RTM RTM is offline Forum Advisor  
Registered User
Join Date: Apr 2002
Last Activity: 16 August 2017, 7:13 PM EDT
Location: On my motorcycle
Posts: 3,093
Thanks: 1
Thanked 34 Times in 9 Posts
if [ .$1 = . ] || [ .$2 = . ] || [ .$3 = . ] ; then
echo "missing parameter"
Sponsored Links

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to write If statement using && and operator in Unix Avi Shell Programming and Scripting 2 06-01-2011 07:35 AM
read/write,write/write lock with smbclient fails swatidas11 IP Networking 1 03-05-2010 10:26 AM
How is use sselect statement o/p in insert statement. nkosaraju Shell Programming and Scripting 2 08-06-2008 09:26 PM
If statement - How to write a null statement april Shell Programming and Scripting 3 04-16-2008 01:14 PM
write statement into one file rinku Shell Programming and Scripting 5 06-25-2007 05:03 AM

All times are GMT -4. The time now is 08:03 PM.