Solved

Need some interactivity in a shell script...

Posted on 2006-11-30
2
218 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

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

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…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
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.

863 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now