Find the answer to your Linux question:
Results 1 to 4 of 4
Hi All, I am trying to automate the certain procedures in my project that are used to generate certain certificates. Presently the certificates are generated by manually passing the parameters ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Newbie rinjo's Avatar
    Join Date
    Feb 2007
    Location
    Bangalore, India
    Posts
    228

    Need help linux scripting


    Hi All,

    I am trying to automate the certain procedures in my project that are used to generate certain certificates.
    Presently the certificates are generated by manually passing the parameters once the tool is invoked in shell.

    Ex:
    Code:
    $ automate
    Please enter first data: data1
    Please enter second data: data2
    .
    .
    .
    Please enter nth data: datan
    I want to totally automate this and do not want to manually enter the data1.. datan.
    I am new to scripting and not sure how I can pass data1... datan in the script itself...

    Can anyone please help me with this?
    Linux Rocks!!!!
    -- Rinjo
    Setup: Oses: Windows 7 HB and Fedora 17 dual boot Hardware: HP Pavilion G6-2005AX laptop, AMD A8 Quad Core, 4 GB RAM, 1.5 GB dual Graphics card, 500GB HDD.

  2. #2
    Just Joined!
    Join Date
    Jul 2011
    Posts
    2
    how is the data generated itself, statically? You could have it/them in a file that the "automate" script looks at? Or you could pass it/them in as an argument?

  3. #3
    Linux Newbie rinjo's Avatar
    Join Date
    Feb 2007
    Location
    Bangalore, India
    Posts
    228
    The data is not self generated.
    It is user inputs that the executable "automate" requires from the user who invoke 'automate'.
    Although the inputs are fixed, there are a large number of inputs that need to be provided. Hence passing them as parameters is out of question.

    I cannot change the 'automate' binary to look at a file, binary is not generated by me.
    My only option is to provide the inputs some how in a secondary script that calls 'automate'.

    And that is where I am stuck....
    how to provide the inputs from a secondary script when 'automate' is being executed?

    Any pointers are highly appreciated...
    Linux Rocks!!!!
    -- Rinjo
    Setup: Oses: Windows 7 HB and Fedora 17 dual boot Hardware: HP Pavilion G6-2005AX laptop, AMD A8 Quad Core, 4 GB RAM, 1.5 GB dual Graphics card, 500GB HDD.

  4. $spacer_open
    $spacer_close
  5. #4
    Just Joined!
    Join Date
    Jun 2011
    Location
    Belgium
    Posts
    84

    Post

    If your inputs are fixed: put all your inputs in a file, each input parameter on one line.
    example of input file 'automate.in':
    Code:
    data1
    data2
    ...
    ...
    datan
    Then execute :
    Code:
    $ automate > /dev/null < automate.in
    I have tried it with a small C program that use the functions printf and scanf, and it works. There may be a problem if the binary 'automate' disables the rederection.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •