Jump to content

Please Kindly Help me with shell script

- - - - -

  • Please log in to reply
1 reply to this topic

#1
alice06

alice06

    Newbie

  • Members
  • PipPip
  • 14 posts
Hi all

I run my program prog.c in the following way :

$ ./prog 1 > output.txt

where 1 is a user defined initial value used by the program.

But now I want to run it for many a thousand initial values, 1-1000, and store all the outputs in different files.
Like
$ ./prog 1 > output1.txt

$ ./prog 2 > output2.txt

$ ./prog 3 > output3.txt

.

.

.

$ ./prog 1000 > output1000.txt

I know that a shell script (using a for loop and a variable output file name) can be VERY useful.
But I dont know how to make it.
PLEASE HELP

Regards
Alice

#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 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
Bash For Loop Examples
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users