#! /bin/csh
#
# this is a simple script to explore different unix commands
# given the temp in degree fahrenheit, it computes temp in degrees celsius
# however unix scripts can only do integer arithmetic, so it doesnt convert
# very well!!!!!
#
#set input on command line to variable temp
set temp = $1
echo input temperature is $temp

@ tc = 5 * ( $temp - 32 ) / 9

echo output temperature is $tc

#
# now create conversion table
#
# remove temp.temp file
 
rm -f temp.temp

foreach temp ( -10 -5 0 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 )
 @ tc = 5 * ( $temp - 32 ) / 9
#save output to file temp.temp
 echo $temp $tc >> temp.temp
end

#size of file after seeing if exists

if ( -e temp.temp ) wc temp.temp

# now lets search the file for a specific temperature
#three types of quotes "everything in here is literal except variables like $temp"
# 'really everything is treated literally except !'
# `everything in here is treated as a command`
set file = `cat temp.temp`
echo contents of $file
foreach word ( $file )
echo contents of word $word | more
if ( $word == 80 ) echo found temp eq 80
end
