Creating a script requiring a pause for user input


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Creating a script requiring a pause for user input
# 8  
Old 04-30-2013
Quote:
continue to check others without exiting the script every time
Here is one good way to do it:
Code:
while [ 1 -eq 1 ]; do
  echo -n "Please Enter Name Of .pem File To Be Checked [ENTER]: "
  read file

  if [ -f "$file" ]; then
    openssl x509 -text -in "$file"
  else
    echo "File Doesn't Exist: $file"
  fi

  echo -n "Do you wish to check another [y/n]: "
  read yn
  if [ "$yn" != "y" ]; then
    exit # from shell script
  fi
done

This User Gave Thanks to hanson44 For This Post:
# 9  
Old 04-30-2013
while : ; do
or use select as previously suggested.
# 10  
Old 05-01-2013
Why not
Code:
$ while read -p "Enter file name; <ctrl>D to end" file
     do  [ -f "$file" ] && openssl x509 -text -in "$file"  || echo "File Doesn't Exist: $file" 
     done

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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

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

8. 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

9. 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

10. 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
Login or Register to Ask a Question