Sponsored Content
Top Forums Shell Programming and Scripting Creating a script requiring a pause for user input Post 302800257 by Buddyluv on Monday 29th of April 2013 09:41:28 AM
Old 04-29-2013
Linux Creating a script requiring a pause for user input

Hi I'm trying to create a basic script that pauses for user input to verify a file name before generating the output.

I have numerous SSL certificate files which I am trying to determine the expiry date so what I'm trying to do is write a script so that is pauses to request the name of the .pem file and then checks that the file within the directory then runs the command against that file to output the Certificate info. This is what I'm looking for.

Code:
#!/bin/bash
#
# This Script Will Check the Validity Of an SSL CERT

echo  "Please Enter Name Of .pem File To Be Checked [ENTER]:"
echo
echo
          [Checks That File Exists.... 

      if exists then 

  openssl x509 -text -in {name of .pem file user has input}

     if file doesn't exist then

 print .pem file doesn't exist 

exit

Any help on this please
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

creating unique lists from user input

hi all, I'm trying to resolve a scenario where we prompt the user to enter 1 or more disk names. From there we would run a command on each disk which would give its location. This would allow us to create a list of disks at location A, a list of disks at location B,....etc... Any help... (1 Reply)
Discussion started by: annie
1 Replies

2. AIX

script for creating aix user

Hi Guys, I want to create user with a script: user name, user id, primary group, group set, home directory, initial program, password, user information, another user can SU to user. And all the rest is the default. Does anyone already have the script for this? Can you please share it... (8 Replies)
Discussion started by: itik
8 Replies

3. Shell Programming and Scripting

User input for execution of script

Hi, I need to get the user input and execute a particular script based on the input provided. For E.g. When I execute the script say Test.sh it should prompt "For which country I need to execute the script? (US/India)" Based on the input as US or India from the user the execution of... (8 Replies)
Discussion started by: yoursdavinder
8 Replies

4. Shell Programming and Scripting

BASH: Any Way to Get User Input Without Requiring Them to Hit the Enter Key?

I'm working on making a menu system on an HP-UX box with Bash on it. The old menu system presents the users with a standard text menu with numbers to make selections. I'm re-working the system and I would like to provide something more akin to iterative search in Emacs. I have a list of 28... (2 Replies)
Discussion started by: deckard
2 Replies

5. Shell Programming and Scripting

Creating oracle user and giving him grants using shell script

Hi , I want to write a shell script that can create oracle database user and grants permission to this user. Thanks & Regards, Deepak (4 Replies)
Discussion started by: Deepakjha
4 Replies

6. Shell Programming and Scripting

User Input Shell Script

Hello I am trying to create a user input shell scipt. The objective is user should enter the circuit number and the input is saved in a log file. If the user does not enter anything then the question should prompt it until the circuit no. is entered. Can any one please correct the code below.... (3 Replies)
Discussion started by: sureshcisco
3 Replies

7. Shell Programming and Scripting

How to take input from user or awk script?

Hi Jim, I have following script,i which i need to take dynamic value . script, nawk -v v1=grep"INT_EUR" $propertifilename | cut -d"=" -F2` -F'~' '{if (NF-1 !=v1) {print "Error in " $0 " at line number "NR" tilde count " N-1}}' $filename In the above script i want to use INT_EUR as a variable... (2 Replies)
Discussion started by: Ganesh Khandare
2 Replies

8. Shell Programming and Scripting

Script interacts with user , based on user input it operates

i have a script which takes input from user, if user gives either Y/y then it should continue, else it should quit by displaying user cancelled. #!/bin/sh echo " Enter your choice to continue y/Y OR n/N to quit " read A if then echo " user requested to continue " ##some commands... (7 Replies)
Discussion started by: only4satish
7 Replies

9. UNIX for Dummies Questions & Answers

Creating a new directory by getting input from user

Hi All, I am really new to Linux.I am trying to write a script for creating a new directory by getting input of folder name from the user.Please help me in this regard. #! /bin/bash echo "Enter name of dir":$filename mkdir -p $filename When executing this I am getting following error ... (13 Replies)
Discussion started by: Pradeep_1990
13 Replies

10. Shell Programming and Scripting

Help Me. The script should not exit until the user gives an input.

Hi everyone, I'm new here and just a beginner in linux scripting. Just want to ask for help on this one. I am trying to create a script that will accept user input (year-month and user/s). I wanted to have the script to continue running, until the user inputs a DATE and name/s of user/s. ... (2 Replies)
Discussion started by: Helskadi
2 Replies
CA.PL(1)							      OpenSSL								  CA.PL(1)

NAME
CA.pl - friendlier interface for OpenSSL certificate programs SYNOPSIS
CA.pl [-?] [-h] [-help] [-newcert] [-newreq] [-newreq-nodes] [-newca] [-xsign] [-sign] [-signreq] [-signcert] [-verify] [files] DESCRIPTION
The CA.pl script is a perl script that supplies the relevant command line arguments to the openssl command for some common certificate operations. It is intended to simplify the process of certificate creation and management by the use of some simple options. COMMAND OPTIONS
?, -h, -help prints a usage message. -newcert creates a new self signed certificate. The private key and certificate are written to the file "newreq.pem". -newreq creates a new certificate request. The private key and request are written to the file "newreq.pem". -newreq-nowdes is like -newreq except that the private key will not be encrypted. -newca creates a new CA hierarchy for use with the ca program (or the -signcert and -xsign options). The user is prompted to enter the file- name of the CA certificates (which should also contain the private key) or by hitting ENTER details of the CA will be prompted for. The relevant files and directories are created in a directory called "demoCA" in the current directory. -pkcs12 create a PKCS#12 file containing the user certificate, private key and CA certificate. It expects the user certificate and private key to be in the file "newcert.pem" and the CA certificate to be in the file demoCA/cacert.pem, it creates a file "newcert.p12". This com- mand can thus be called after the -sign option. The PKCS#12 file can be imported directly into a browser. If there is an additional argument on the command line it will be used as the "friendly name" for the certificate (which is typically displayed in the browser list box), otherwise the name "My Certificate" is used. -sign, -signreq, -xsign calls the ca program to sign a certificate request. It expects the request to be in the file "newreq.pem". The new certificate is writ- ten to the file "newcert.pem" except in the case of the -xsign option when it is written to standard output. -signCA this option is the same as the -signreq option except it uses the configuration file section v3_ca and so makes the signed request a valid CA certificate. This is useful when creating intermediate CA from a root CA. -signcert this option is the same as -sign except it expects a self signed certificate to be present in the file "newreq.pem". -verify verifies certificates against the CA certificate for "demoCA". If no certificates are specified on the command line it tries to verify the file "newcert.pem". files one or more optional certificate file names for use with the -verify command. EXAMPLES
Create a CA hierarchy: CA.pl -newca Complete certificate creation example: create a CA, create a request, sign the request and finally create a PKCS#12 file containing it. CA.pl -newca CA.pl -newreq CA.pl -signreq CA.pl -pkcs12 "My Test Certificate" DSA CERTIFICATES
Although the CA.pl creates RSA CAs and requests it is still possible to use it with DSA certificates and requests using the req(1) command directly. The following example shows the steps that would typically be taken. Create some DSA parameters: openssl dsaparam -out dsap.pem 1024 Create a DSA CA certificate and private key: openssl req -x509 -newkey dsa:dsap.pem -keyout cacert.pem -out cacert.pem Create the CA directories and files: CA.pl -newca enter cacert.pem when prompted for the CA file name. Create a DSA certificate request and private key (a different set of parameters can optionally be created first): openssl req -out newreq.pem -newkey dsa:dsap.pem Sign the request: CA.pl -signreq NOTES
Most of the filenames mentioned can be modified by editing the CA.pl script. If the demoCA directory already exists then the -newca command will not overwrite it and will do nothing. This can happen if a previous call using the -newca option terminated abnormally. To get the correct behaviour delete the demoCA directory if it already exists. Under some environments it may not be possible to run the CA.pl script directly (for example Win32) and the default configuration file location may be wrong. In this case the command: perl -S CA.pl can be used and the OPENSSL_CONF environment variable changed to point to the correct path of the configuration file "openssl.cnf". The script is intended as a simple front end for the openssl program for use by a beginner. Its behaviour isn't always what is wanted. For more control over the behaviour of the certificate commands call the openssl command directly. ENVIRONMENT VARIABLES
The variable OPENSSL_CONF if defined allows an alternative configuration file location to be specified, it should contain the full path to the configuration file, not just its directory. SEE ALSO
x509(1), ca(1), req(1), pkcs12(1), config(5) 0.9.7a 2001-01-11 CA.PL(1)
All times are GMT -4. The time now is 03:42 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy