The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



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

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
awk doubt.. esham Shell Programming and Scripting 11 10-11-2007 02:24 AM
Condition test ( [[ ]] ) doubt thambi Shell Programming and Scripting 2 08-17-2007 02:52 AM
doubt in AWK abnirmal Shell Programming and Scripting 4 05-08-2007 05:27 PM
doubt on name shruti_mgp UNIX for Dummies Questions & Answers 1 03-10-2005 10:21 AM
doubt it sed esham Shell Programming and Scripting 2 03-08-2005 01:52 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 03-05-2008
ravi raj kumar ravi raj kumar is offline
Registered User
  
 

Join Date: Dec 2006
Location: hyderabad
Posts: 102
IF condition doubt

Hi i found the following code in a date calculation script.

if ((!(year%100))); then
((!(year%400))) && leap=1
else
((!(year%4))) && leap=1
fi
I have not find such an use of if statement till now.
As for my knowledge this is the syntax of if statement

if [ condition_A ]
then
code to run if condition_A true
elif [ condition_B ]
then
code to run if condition_A false and condition_B true
fi

Can any one tell me how the above code works.


cheers
RRK
  #2 (permalink)  
Old 03-05-2008
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,643
That is ksh the (( .. )) construct: it is equivalent to let for arithmetic operations.

$(( .. )) lets you assign the result to a variable.

see man ksh for more information.
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 04:30 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0