19.03.2015 Views

Unix Tutorial

test

test

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

echo "File size is zero"<br />

else<br />

echo "File size is not zero"<br />

fi<br />

if [ -e $file ]<br />

then<br />

echo "File exists"<br />

else<br />

echo "File does not exist"<br />

fi<br />

This would produce following result:<br />

File has read access<br />

File has write permission<br />

File has execute permission<br />

File is an ordinary file<br />

This is not a directory<br />

File size is zero<br />

File exists<br />

There are following points to note down:<br />

<br />

There must be spaces between operators and expressions for example 2+2 is not correct, where as it<br />

should be written as 2 + 2.<br />

<br />

if...then...else...fi statement is a decision making statement which has been explained in next chapter.<br />

C Shell Operators:<br />

This lists down all the operators available in C Shell. Here most of the operators are very similar to what we have<br />

in C Programming language.<br />

Operators are listed in order of decreasing precedence:<br />

Arithmetic and Logical Operators:<br />

Operator<br />

Description<br />

( ) Change precedence<br />

~ 1's complement<br />

! Logical negation<br />

* Multiply<br />

/ Divide<br />

% Modulo<br />

+ Add<br />

- Subtract<br />

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!