View Single Post

  #1 (permalink)  
Old 05-07-2008, 06:40 AM
beginer beginer is offline
Junior Member
User
 
Join Date: May 2008
My distro: knoppix
Posts: 1
Rep Power: 0
beginer is on a distinguished road
Default Read one integer from a file, cannot find info

I have read three linux scripting tutorials and still cannot find the answer to this... To many of you this may sound too simple, but as a beginner I am having a real hard time finding out how to read a single integer stored in a file, to process its value thereafter. his is what I have:

# user at console types input data file name:

read fname1

# open fname1 and load integer to int1

open $fname1
read $fname1, int1
echo expr $int1 / 2

That's all I need to do, please help me with the syntaxt, I am following the tutorials but would like to know how to open, read a data element so I can do something with it before I go forward.

Thank you
Reply With Quote