Solved

Need some interactivity in a shell script...

Posted on 2006-11-30
2
221 Views
Last Modified: 2010-04-20
Hello, I want to run these commands in a bash shell script

rug service-list
rug refresh
rug list-updates
---ask root here---
rug update  (*)

Before (*) is executed I want to ask the user (mostlikely root), if he agrees (some press "y" to execute question)
If anything else is pressed like "n" (*) command should be skip and that batch file finished.

Reason: "rug list-updates" gives me a list all new updates and there might be a reason to skip the automatic update.

This is for SLES 10 yum update proxy.

Thank you,
Tolomir
0
Comment
Question by:Tolomir
2 Comments
 
LVL 45

Accepted Solution

by:
sunnycoder earned 200 total points
ID: 18051965
Hi Tolomir,

echo -n "do you wish to continue (y/n)?"
read var

#use $var here to determine your actions
if [ "$var" = "n" ]
then
      echo "you entered n"
else
      echo "you did not enter n"
fi

Cheers!
sunnycoder
0
 
LVL 27

Author Comment

by:Tolomir
ID: 18052053
Cool, thank you.

Tolomir
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Network Interface Card (NIC) bonding, also known as link aggregation, NIC teaming and trunking, is an important concept to understand and implement in any environment where high availability is of concern. Using this feature, a server administrator …
If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question