equal to operator | Unix Linux Forums | Shell Programming and Scripting

  Unix/Linux Go Back    

Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

equal to operator

Shell Programming and Scripting

Closed Linux or Unix Question    
Thread Tools Search this Thread Display Modes
Old Unix and Linux 02-08-2010
anijan anijan is offline
Registered User
Join Date: Feb 2010
Last Activity: 12 September 2014, 5:33 AM EDT
Location: Chennai, India
Posts: 31
Thanks: 1
Thanked 0 Times in 0 Posts
equal to operator

I have the below script executed

if "$arg" = "dir"
    echo "true"
    echo "false"

Please let me know what happens in the if command.
My output is:

dir: dir: No such file or directory
which is not the desired output.
When i used test command it works fine.
Please explain the significance of = (and if command) in the above code.
Sponsored Links
Old Unix and Linux 02-08-2010
Franklin52's Unix or Linux Image
Franklin52 Franklin52 is offline Forum Staff  
Join Date: Feb 2007
Last Activity: 31 March 2015, 6:06 AM EDT
Location: The Netherlands
Posts: 7,730
Thanks: 128
Thanked 544 Times in 512 Posts
You can have a read of:

BASH Programming - Introduction HOW-TO: Conditionals

Sponsored Links
Closed Linux or Unix Question

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Unix or Linux Image More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Regex NOT EQUAL help ArterialTool Shell Programming and Scripting 6 08-13-2009 05:52 PM
awk check for equal - help uwork72 Shell Programming and Scripting 12 02-27-2009 05:12 AM
Edit entry if not equal kenshinhimura Shell Programming and Scripting 4 08-06-2008 11:18 PM
Stop+A equal tlee Solaris 5 07-01-2008 06:42 AM
add not equal in script. myguess21 Shell Programming and Scripting 2 02-26-2008 09:20 AM

All times are GMT -4. The time now is 08:37 AM.