LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-04-2008, 09:08 AM   #1
nakulashishsaxena
LQ Newbie
 
Registered: Jul 2008
Posts: 1

Rep: Reputation: 0
Unhappy where is the diff: in these two program


here are the two codes

1> code 1
#!/bin/sh

echo -n "enter file name"
read file
c=0
sum=0
avg=0

cat $file |{
while read line; do
c=$(expr $c + 1)
sum=$(expr $sum + $c)
echo $$
#avg=`expr $sum / $c`
done
}

echo $$
echo $?
echo c= $d
echo sum= $sum
echo $avg= `expr $sum / $c`

2> code 2

#!/bin/sh

echo -n "enter file name"
read file
c=0
sum=0
avg=0

while read line; do
c=$(expr $c + 1)
sum=$(expr $sum + $c)
echo $$
#avg=`expr $sum / $c`
done < $file

echo $$
echo $?
echo c= $d
echo sum= $sum
echo $avg= `expr $sum / $c`
--------------------------------------------------------------------


I'm getting solution from second code,...
what i'm thinking is that processes is being forked as we called CAT command
but not fully satisfied
Can ny body help me?
 
Old 08-04-2008, 06:01 PM   #2
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 63
See: http://tldp.org/LDP/abs/html/redircb.html#REDIR2
 
  


Reply

Tags
help



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Using Diff metallica1973 Linux - General 17 12-06-2007 07:38 AM
Dual Boot diff Hard Disk diff OS on Suse 9.1 wilhem Linux - Newbie 1 08-13-2004 06:06 PM
2 diff errors on my Crack5 program Israfel2000 Linux - Software 0 05-30-2004 01:02 PM
What a Diff! perry General 0 12-05-2003 07:10 PM
what is the diff safrout Linux From Scratch 2 05-27-2002 07:20 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:46 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration