LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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, 10: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, 07:01 PM   #2
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

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


Reply

Tags
help


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 08:38 AM
Dual Boot diff Hard Disk diff OS on Suse 9.1 wilhem Linux - Newbie 1 08-13-2004 07:06 PM
2 diff errors on my Crack5 program Israfel2000 Linux - Software 0 05-30-2004 02:02 PM
What a Diff! perry General 0 12-05-2003 08:10 PM
what is the diff safrout Linux From Scratch 2 05-27-2002 08:20 AM


All times are GMT -5. The time now is 04:54 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration