Error in script confirmed and to be continued


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Error in script confirmed and to be continued
# 1  
Old 08-30-2010
Error in script confirmed and to be continued

Hello.

I have a problem.

When i run 1.sh, ask me yes or no, and, if i asnwerd yes, there continue the procediment
Code:
"sudo -u root echo hello"

. All without putting it into a single script, and who uses the confirm many more scripts.


I have two script.
============
1 with the following code confirm.sh
#################################
Code:
#!/bin/bash
while true; do
    echo
    read -p "esta seguro de hacer lo que sea que vaya a hacer (yes/n)" yn
    case $yn in
        yes ) break;;
        not ) exit;;
        * ) echo "por favor responda yes o no";;
    esac
done

2º script 1.sh
#######
Code:
confirm.sh normal ("sudo-u root stopserver.sh")


Last edited by ave-phoenix; 08-30-2010 at 11:29 AM..
# 2  
Old 08-30-2010
I did not understand.

You want a script that takes [yes|no] and if the answer is "yes", you want it to echo some text, right?
As a side note, you do not need to sudo for a simple echo. Every user with a shell can do this.
This User Gave Thanks to zaxxon For This Post:
# 3  
Old 08-30-2010
Thanks.. i change de code, but this is the problem

Quote:
Originally Posted by zaxxon
I did not understand.

You want a script that takes [yes|no] and if the answer is "yes", you want it to echo some text, right?
As a side note, you do not need to sudo for a simple echo. Every user with a shell can do this.

Last edited by ave-phoenix; 08-31-2010 at 03:24 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

4 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Reading a long literal continued next line

I am trying to identify all messages or prompts from a number of COBOL programs and they can usually be identified by a pair of double quotes on one line. However, sometimes the literal will not be finished on the first line but after a dash in column 7 of the next line, the literal will be... (6 Replies)
Discussion started by: wbport
6 Replies

2. Linux

Debian Grub 1.99 alters BIOS (confirmed after formatting hard disk)

Hi, I am a long time Windows user and recently try this Debian Wheezy OS. Burn Debian ISO in Windows environment and then select DVD ROM drive to boot first in BIOS. The first installation of Debian (GNOME) was with multi-boot option that allows booting from hard disk and DVD drive. I then... (4 Replies)
Discussion started by: Linuxmun
4 Replies

3. Shell Programming and Scripting

Parallel processing - continued

Hi, I am taking up the cue from where I was left in my earlier post ( link given below ) https://www.unix.com/shell-programming-scripting/231107-implement-parallel-processing.html I actually wanted to know the significance of using the Unix "wait" , which returns the control from background to... (3 Replies)
Discussion started by: kumarjt
3 Replies

4. UNIX for Dummies Questions & Answers

Scrolling text continued

Perderabo * Unix Daemon * Join Date: Aug 2001 Location: Ashburn, Virginia Posts: 9,071 Using head and tail like that is terribly inefficient. I decided to try a rewrite. Sheesh...I spent all morning on this.... Code: #! /usr/bin/ksh # # scroller --- display text, but sleep every... (0 Replies)
Discussion started by: jamesapp
0 Replies
Login or Register to Ask a Question