Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Need some interactivity in a shell script...

Posted on 2006-11-30
2
Medium Priority
?
226 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 800 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
This article will show you step-by-step instructions to build your own NTP CentOS server.  The network diagram shows the best practice to setup the NTP server farm for redundancy.  This article also serves as your NTP server documentation.
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
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.
Suggested Courses
Course of the Month7 days, 12 hours left to enroll

824 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