05-07-2008
1 - Yeah, that's what I meant. Put the message that the process is starting, BEFORE it starts.
2 - I hadn't copied and tried it myself until now. I got the same error and had to scratch my head a bit before I figured it out. You're going to hate yourself: You have an extra quote at the begining of line TWO!
case vs if ? Use case when there are multiple options. Use if when there aren't.
Note, I would have done it a little different:
read answer
ans=`cat $answer"N" | cut -c1-1 | tr "y" "Y"`
if [ $ans = "Y" ]
This accomplishs a couple things: It adds a default answer. Uses only the first character, doesn't care if it's upper or lower case.
If there were multiple choices, I'd use the same type of logic to get A, B, C... responses, and then use case:
read answer
ans=`cat $answer"X" | cut -c1-1 | tr "a-z" "A-Z"`
case $ans in
Last edited by Dave Miller; 05-07-2008 at 08:48 AM..
7 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
All,
I have a list of over 400 users that need certain directories created. These will be created in /users/$username on a system and I need a directory called chess under these directories that I create.
Instead of me manually adding each one (mkdir /users/user1, mkdir /users/user1/chess)... (1 Reply)
Discussion started by: kjbaumann
1 Replies
2. Shell Programming and Scripting
a) Total number of words in the file.
b) Total number of different words in the file.
How can I use the translate and/or unique commands to accomplish this (4 Replies)
Discussion started by: EECSDAVE
4 Replies
3. Shell Programming and Scripting
Hello,
I need assistance with creating a shell script to generate SSL Certificate Requests on remote hosts. Below is my stab at this, but I cannot figure out how to pass the requested arguments into the openssl command correctly. I have a major problem with redirecting the "answers" into the... (2 Replies)
Discussion started by: azvelocat
2 Replies
4. Shell Programming and Scripting
Hi,
I am new in perl.
I am running a perl installation script, its asking for paths and so many inputs.
Can we provide that info by any file.
so i can avoid the interactive installation. (2 Replies)
Discussion started by: Priy
2 Replies
5. Shell Programming and Scripting
I have a text file in this format
Some lines....
Question no: 1
The question?
A. Answer 1
B. Answer 2
C. Answer 3
D. Answer 4
Answer:B
Some lines....
Question no: 2
The question? (choose 2) (10 Replies)
Discussion started by: zorrox
10 Replies
6. Shell Programming and Scripting
Hello everybody,
I use `case' quite a lot but , excellent as it is , it only gives one
final result ; can anyone suggest a way whereas , say long
lists of choices are given and I , or a user could select either one
two or any number of results to be echoed .
many thanks in... (3 Replies)
Discussion started by: V686
3 Replies
7. Shell Programming and Scripting
Hey everyone, just now joined because I didn't want to go onto Ubuntu forums and start asking about how to write shell scripts. Seems like this is a pretty active forum for exactly what I need.
I'm trying to modify a shell script I found online, the end goal is to have it find all files in the... (9 Replies)
Discussion started by: mozzles
9 Replies
LEARN ABOUT DEBIAN
service
service(8) System Manager's Manual service(8)
NAME
service - run a System V init script
SYNOPSIS
service SCRIPT COMMAND [OPTIONS]
service --status-all
service --help | -h | --version
DESCRIPTION
service runs a System V init script in as predictable an environment as possible, removing most environment variables and with the current
working directory set to /.
The SCRIPT parameter specifies a System V init script, located in /etc/init.d/SCRIPT. The supported values of COMMAND depend on the
invoked script. service passes COMMAND and OPTIONS to the init script unmodified. All scripts should support at least the start and stop
commands. As a special case, if COMMAND is --full-restart, the script is run twice, first with the stop command, then with the start com-
mand.
service --status-all runs all init scripts, in alphabetical order, with the status command.
EXIT CODES
service calls the init script and returns the status returned by it.
FILES
/etc/init.d
The directory containing System V init scripts.
ENVIRONMENT
LANG, TERM
The only environment variables passed to the init scripts.
SEE ALSO
/etc/init.d/skeleton,
update-rc.d(8),
init(8),
invoke-rc.d(8).
Jan 2006 service(8)