Solved

Need some interactivity in a shell script...

Posted on 2006-11-30
2
224 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

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

Using 'screen' for session sharing, The Simple Edition Step 1: user starts session with command: screen Step 2: other user (logged in with same user account) connects with command: screen -x Done. Both users are connected to the same CLI sessio…
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
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.
Suggested Courses

636 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