Jump to content





Recent Status Updates

  • Photo
      16 Apr
    Kadence

    If you're reading this, you're on my profile and I know you're on my profile because I'm probably viewing yours.

    Show comments (6)
  • Photo
      10 Apr
    Poe

    Finally (and hopefully) i'm getting a team together that knows a little of this and a little of that; and maybe all my open source projects that are half written can begin to be released. :)

View All Updates
Photo
- - - - -

read file with if argument.....


  • Please log in to reply
7 replies to this topic

#1 kiddies

kiddies

    CC Addict

  • Advanced Member
  • PipPipPipPipPip
  • 129 posts

Posted 31 July 2009 - 06:16 AM

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

#2 WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderator
  • 16,615 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others

Posted 31 July 2009 - 07:33 AM

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

#3 kiddies

kiddies

    CC Addict

  • Advanced Member
  • PipPipPipPipPip
  • 129 posts

Posted 01 August 2009 - 01:36 AM

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...
  • 0

#4 WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderator
  • 16,615 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others

Posted 01 August 2009 - 04:20 AM

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

#5 kiddies

kiddies

    CC Addict

  • Advanced Member
  • PipPipPipPipPip
  • 129 posts

Posted 02 August 2009 - 06:33 AM

ok, i cannot understand in shell script sir...
  • 0

#6 WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderator
  • 16,615 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others

Posted 02 August 2009 - 07:15 AM

What are you trying to do?
  • 0
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#7 kiddies

kiddies

    CC Addict

  • Advanced Member
  • PipPipPipPipPip
  • 129 posts

Posted 04 August 2009 - 06:24 AM

just wanna learn n make it work well...
  • 0

#8 WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderator
  • 16,615 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others

Posted 04 August 2009 - 06:33 AM

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.
  • 0
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog