Now i want that when my script gives the output so it ask with me at the end to exit or not , if i enter y so it exits and if i enter n so it starts once again.
Please explain how to do this...
That's an endless loop; you break out of it by not replying "y" (or yes, or yowza, or ypsilon) at the prompt.
echo -n is not completely portable; see the manual page for your shell, or your echo command, to see what works at your site. (Might be 'echo "Play again? [y/N] \c"' too. Many shells have echo built into the shell, but most sites also have a /bin/echo in case some users have an old shell which doesn't have its own echo command. You need to figure out which one works for you.)
The branch for the first matching pattern is taken, and subsequent ones are ignored.
So in this case if $reply matches the pattern [Yy]* we do nothing (no commands before the terminating double semicolon) and otherwise (the pattern * matches all possible values), the command we execute is "break", which breaks out of the while loop.
If you need awk and the shell to perform your job, perhaps you could persuade your manager to set aside some time for you to read a book on shell programming ...?
Hello,
I have a tab delimited list of 311 server & account names which I want to read those 2 variables and then connect to each server and get info on that particular job account. I've tried the following:
while read server acct; do
printf "********$server\t $acct***********\n"
... (3 Replies)
Hi.. i am running nawk scripts on solaris system to get records of file1 not in file2 and find duplicate records in a while with the following scripts -compare
nawk 'NR==FNR{a++;next;} !a {print"line"FNR $0}' file1 file2duplicate - nawk '{a++}END{for(i in a){if(a-1)print i,a}}' file1in the middle... (12 Replies)
Hia,
echo ${!S*}
gives me all those env vars starting with S like SHELL SECONDS SHELLOPTS SHLVL etc.
is there any way to deflate the shell variables' range like
echo ${!A-E*} OR echo ${!A..S*}
to list all env vars starting within range of A till E. Thanks
Regards,
Nasir (1 Reply)
Hi I have an issue, I want to get variables from an external file. Variable file var1=test var2-test2 I want to get these vars from another shell script. Does any one know how? (5 Replies)
I have about 20 different variables that I need to check for null values then replace with a specific string if they are null. I've been doing this via 20 different if then statements like this:
if ; then
WIND="UUU"
fi
Is there a more elegant way to do this? The vars aren't sequential in... (6 Replies)
i'm new to shell scripting and have a problem please help me
in the script i have a nawk block which has a variable count
nawk{
.
.
.
count=count+1
print count
}
now i want to access the value of the count variable outside the awk block,like..
s=`expr count / m`
(m is... (5 Replies)
Im running a script that runs scripts within it self and i need to pass vars made in the original script to scripts run within it and the only way i can think to do it is right the string to a file and read the file in the script (4 Replies)
Hello,
<Preamble>
I'm writing an installation script for use with PKGADD. What I want to do is take one of the variables set in the REQUEST script and use that in the install script so I can change applications configuration.
My install script is as follows:
sed '
/^DIRNAME/ i\... (8 Replies)
I'm trying to pass nawk a shell variable to be used in a pattern match. I can't get this work.
I'm calling nawk from a /bin/sh
echo " Input file: \c"
read var1
echo " Input: \c"
read var2
nawk -F"|" -v x=$1 ' BEGIN
$15 ~ /^'$var2'/ {print $2}' var1 {apary=$15; bparty=$23; time=$4;... (3 Replies)