Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Linux script help !

Status
Not open for further replies.

Wahero

Technical User
Oct 5, 2001
6
MO
Can anyone help me following :

I am using openssl to generate req and sign the cert.

./CA -newreq
./CA -sign
in above script I must enter many input parameters , like PEM,CN,State,city,and Common name...

The problem was that I must generate many req and sign the certs .
I want to write a batch script to do the job more qucikly.
The input parameter I will store it in a file , just like:

IP:192.33.88.1 CN:item1
IP:192.33.88.2 CN:item2
IP:192.33.88.3 CN:item3

then read them in the script , and process the req generate and sign action.

May anyone give me some sample . Thanks a lot.
 
Ok - if I understand you correctly this is simple...

Firstly, you have a file "inputs" which contains something like:

192.33.88.1 item1
192.33.88.2 item2
etc...

You should remove the fields labels (ie IP:).

You can then do a script:

cat inputs | while read LINE
do
`command you want to run goes here`
done


Then, for every line in the input file, you can run a command, and use $1, $2, $3 etc.

$1 will automatically be the first element in the file (like 192.33.88.1) and $2 will be item1 and so on...

You can put whatever you want between do and done and it will automatically execute the commands for each input line in the input file.

Is this what you wanted??

Regs,

ChrisCW

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top