Sunday, July 26, 2009

Hi I am programming c code in unix c-shell?

#!/bin/csh


# This program will add integers


#


#


# add integer1 ..


#





# Check for argument


if ($#argv == 0 ) then


echo "usage: add integers"


exit 1


else


set input = $argv[*]


endif


#


set @ sum = 0


foreach var (input)


$sum = $sum + $var


end


#


echo "The sum total of the integers is $sum"


#


exit 0


#





This is the code I have so far, I am trying to have the program add every integer that is inputted.

Hi I am programming c code in unix c-shell?
This isn't C code, this is shell script.





Try this search on yahoo or google:


unix shell script tutorial


No comments:

Post a Comment