Jump to content

read file with if argument.....

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
7 replies to this topic

#1
kiddies

kiddies

    Programmer

  • Members
  • PipPipPipPip
  • 130 posts
hey master, i wanna ask about read file with if argument, couse i always get script for read file with while argumrnt...

#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
Can you give an example of what you're talking about?
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
kiddies

kiddies

    Programmer

  • Members
  • PipPipPipPip
  • 130 posts

Quote

value=0;

while read line
do
value=`expr $value + 1`;
echo $value;
done < "myfile"

echo $value;

i will make this with if argument...can u change it...

#4
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
You'll need some kind of loop... I'm still not clear on what you're trying to accomplish.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#5
kiddies

kiddies

    Programmer

  • Members
  • PipPipPipPip
  • 130 posts
ok, i cannot understand in shell script sir...

#6
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
What are you trying to do?
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#7
kiddies

kiddies

    Programmer

  • Members
  • PipPipPipPip
  • 130 posts
just wanna learn n make it work well...

#8
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
When writing software, the first step is to think in terms of "What are my inputs, what are my outputs?" You then write processing to get from your inputs to your outputs.

What you have given is the processing, but neither the inputs nor the desired outputs. Based on that, I cannot help you because I don't know the purpose of the code you wrote, what it's supposed to do, or why it is inadequate.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog