Hello, I have been working on a what I thought was a fairly simple script for installing a software kit on Linux and Unix
I am not new to scripting but am far from being fluent in sh scripting.
any assistance would be appreciated.
I have an odd bug occuring when executing the script.
When executing the script in Interactive mode
A series of questions are asked. then verified.
If you run the script and do not choose to use the default directory for install.
for example:
the question asked is
Where would you like to install the software? The default is : [ /tmp/username ]" type /bin and press enter here
then when asked if you are sure you want to use /bin select N for NO
then change it to /var or any other dir.
then proceed by selecting Y
you will then be told that you have http alreayd running...( this is hardcoded with no checks yet. It is a concept)
choose Y or N
the script should proceed.
Where I am seeing a problem is I get asked the question about http Twice ....Only when I change the default directory twice or more
any idea how to prevent this ?
better yet Can you explain Why it is doing this so I can prevent this from happening with other scripts ?
The code below does not install anything ...it simply generates a log file at this time.
Thanks again for any assistance with this bug.
RobertMCol
Yeah, you've called "process_interactive" recursively. When you get the "Are you sure prompt" and you enter "No", it calls process_interactive() again and eventually gets to the HTTP prompt for the first time. When that call returns/finishes, it continues at the prior execution point, which is to continue with the
loop. When it finishes with that, it goes to the HTTP prompt for the second time. You can fix this with a double loop.
To see what I mean about the recursion, throw in a debugging statement at the top of the function call, like this:
If you are using ksh or bash, you can also turn on debugging. At the top of the script (or somewhere), do:
And you will get a line of output for each expression evaluated by the shell during the processing of the script.
Thank you so much, this was driving me nuts wondering why it was occuring.
I was not sure how to go about the double loop when I coded this ,at the time all I knew was that if the parameter needed changing I had to call the function again.
The Double loop works nicely. thank you
so Bottom line here is I should not call Function (A) while in Function A.
Hi Folks,
Before I go off and start checking I'm just wondering if anyone has seen this behaviour before.
# passwd e825390
Changing password for user e825390.
New password:
Retype new password:
Retype new password:
passwd: all authentication tokens updated successfully.
As you can... (2 Replies)
Some background:
The application normally runs on an embedded platform. Currently, for development purposes, I have the rootfs located @ /exports and the target is communicating over NFS. That way I can make a change on my local system, save the application @ /exports, and run the altered... (4 Replies)
Hello,
I often stumble over a common shell coding practise.
Example 1:
#!/bin/sh
#
# Licensed Materials - Property of IBM
# Rational ClearCase
# (C) Copyright IBM Corp. 1999, 2010. All Rights Reserved
# US Government Users Restricted Rights -
# Use, duplication or disclosure restricted... (4 Replies)
Hi folks,
So I wrote a script to run "top", "awk" out values fro the "top" and send the results to a data file.
I then set it to run in cron every 15 minutes.
Now I'm noticing that the script, and it's sub-commands are not always cleanly finishing and, in my investigations, I am also... (11 Replies)
I am creating a startup script for an application. This application's startup script is in bash. It will also need to call a perl script (which I will not be able to modify) for the application environment prior to calling the application. The problem is that this perl script creates a new shell... (5 Replies)
The code I am using
#!/bin/sh
for FILE in *.cfg; do
awk '{
print;
if ($1 == "host_name") store_name = $2;
if ($1 == "register") { printf("\t\t parents\t\t\t %s-ilo\n", store_name); }
}' "$FILE" > ../new-files/hosts/$FILE
sed -i -e "s/notification_options.*/notification_options... (0 Replies)
Is it normal behavior for a shell script that terminates to terminate its parent shell when executed with the "." option?
For example, if I have the example script (we'll name it ex.sh):
#!/bin/sh
if
then
echo "Bye."
exit 2
fi
And I execute it like this:
>./ex.sh
It... (6 Replies)
Hi, We have some troubles with our HP server (rx4640) running HP-UX 11.31. The server is attached to a JBod cabinet. If the JBod cabinet is powered on and we power on the server after then HP-UX can't find the devices (disks) at the cabinet. Does not help to run an ioscan -fnC disk. But if I power... (3 Replies)
I need a unix script that check for even or odd. EXAMPLE::::
please enter the number to check: 12
the output: This is an even number
it has to have prompts. (2 Replies)