12-06-2005
solution:recursively calling a function
hiiii djt0506,
got a easy solution for you
...
you neeed to write a function "function Func_validate_phone_number" which will validate the phone number entered by the user.
if the ph no is blank it will again call the same function and will ask the user to enter it again....until he enters any thing other than "enter".
if you want to validate it further (for valid numbers or no characters etc) then you need to do some more validations....which again quiet easy
.
here is my code....
function Func_validate_phone_number {
if [ -z "$ph" ]
then
echo "Phone Number cannot be blank....please re-enter."
read ph
Func_validate_phone_number "$ph"
else
echo "Thanks for giving your phone number.....bye"
fi
}
echo "Enter the phone number"
read ph
Func_validate_phone_number "$ph"
i have tested it .....it works fine
...
cya
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
This is a search script that I have developed. It finds the records that I look for. However the only thing I want the program to do now is to display a message such as 'Not Found' to appear when a record is not found. So far when a search doesn't display a record, the screen is blank.
... (14 Replies)
Discussion started by: Warrior232
14 Replies
2. Shell Programming and Scripting
Hi everyone - I am sure this is a really simple problem but I'm a total noob at Linux scripting:
I wanted to create a script that allows me to compare the current week number to the contents of a text file in my home directory:
VAR1='date +%V'
VAR2='cat /home/fred/file.txt'
... (6 Replies)
Discussion started by: FiniteRed
6 Replies
3. Shell Programming and Scripting
Hi,
I am new to unix and using linux 7.2. I would like to create a script that would make it easyer for me to run my java programms. At the moment I have to type java myJavaprogram
I am trying to write a script that will allow me to type something like this "myscript myJavaprogram" or maybe... (4 Replies)
Discussion started by: cmitulescu
4 Replies
4. Shell Programming and Scripting
Hi everyone, I am facing to one shell script problem, which is as following
Write a shell script that:
Takes a number of arguments.
For each argument, print out all files in the current directory that contain this substring in their name.
I know I need to use grep for the second... (7 Replies)
Discussion started by: shaloovia
7 Replies
5. Shell Programming and Scripting
Hi all,
Here is my requirement
I have to search 'ORA' word in out.log file,if it is present then i need to send that file (out.log) content to some mail id.If 'ORA' word is not in that file then i need to send 'load succesful' message to some mail id.
The below the shell script is not... (5 Replies)
Discussion started by: mak_boop
5 Replies
6. Shell Programming and Scripting
Hi all,
I have set up a simple awk script to calculate the average of values that are printed out a number of times per second (the number of time the printing occurs varies). The data is of the format shown below:
1 4.43
1 3.65
1 2.45
2 7.65
2 8.23
2 5.65
3 4.65
3 6.21
.. ..
120... (4 Replies)
Discussion started by: omnomtac
4 Replies
7. Shell Programming and Scripting
#!/bin/csh
echo hello world
this is what i got in a text file called ss1.
i type "chmod 755 ss1.txt" to make it executable.
then when i type
ss1
or
ss1.txt
it says
"ss1 command not found"
what am i doing wrong? (19 Replies)
Discussion started by: pantelis
19 Replies
8. UNIX for Dummies Questions & Answers
Hello forum memebers.
can you correct the simple while program.
#! /bin/ksh
count=10
while
do
echo $count
count='expr$count-1'
done
I think it will print 10 to 1 numbers but it running for indefinite times. (2 Replies)
Discussion started by: rajkumar_g
2 Replies
9. Shell Programming and Scripting
#!/bin/bash
cd /media/disk-2
Running
./run.sh
it's not changing directory.Why? (6 Replies)
Discussion started by: cola
6 Replies
10. Shell Programming and Scripting
I want to find and replace string from files present in one directory.
user will input the string to be searched and to replace .
Here is my program but Not working
echo "Enter Old domain name:"
read old
echo "Enter New domain name:"
read new
grep -rl '$old' /var/www/ | xargs sed -i... (4 Replies)
Discussion started by: sunny2802
4 Replies
PHONE(1) General Commands Manual PHONE(1)
NAME
phone - Phone utility for DECnet
SYNOPSIS
phone [options]
Options:
[-vVh] [-s switchhook char] [initial command]
DESCRIPTION
phone is a program that allows the user to communicate interactively with users on VMS systems. Two user interfaces are available: X-Win-
dows (GTK+) and terminal (ncurses). If X-Windows is available and compiled into phone then it will be used unless the -n flag is present on
the command line.
After entering the phone command you will be presented with the phone screen which has windows for the chat and a command-line at the top.
If you are not talking to another user then you can enter commands directly, otherwise you will need to precede commands with the 'switch
hook' character, which defaults to the percent sign (%).
You can also enter a command for phone on the shell command-line. This command will be executed when phone starts up. This makes it conve-
nient to enter commands such as:
'phone answer' or 'phone marsha::chrissie'
In command mode phone understands several commands:
DIAL <node::user> Call a user
ANSWER Answer an incoming call
REJECT Reject an incoming call
EXIT or QUIT Return the the command prompt
HOLD Hold all callers
UNHOLD Unhold callers
HANGUP Hangup the phone
DIR <node> Show users logged into <node>
FACSIMILE <file> Send <file>
HELP Show this help
All commands (apart from QUIT and EXIT) can be abbreviated to 3 characters and all (really all this time) commands are case insensitive.
OPTIONS
-h -? Displays help for using the command.
-V Show the version of phone.
-s Set the switch hook character. This is the character used to switch from talking to another user and entering PHONE commands when
using the terminal interface.x
-n Disables use of the X-windows user interface. Use this to run phone in an xterm.
SEE ALSO
phoned(8)
DECnet utilities March 26 1999 PHONE(1)