Bash script on startup does not respond as expected


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Bash script on startup does not respond as expected
# 1  
Old 10-01-2008
Bash script on startup does not respond as expected

Hi,

I have a bash script which I have referenced in the rc.local of my fedora linux OS. However it doesnt respond the same as when run in terminal from fedora.

The bash script has a series of interactive questions that require user input as shown:

#!/bin/bash
echo "Do you want to use fixed IP address?"
read RESPONSE
...

When this script is run from terminal with Fedora i type in "yes" and the response is recorded as expected in varaible.

However the same script on bootup requires me to input the same thing twice on further examination the first input I type is irrelevant?!? Any ideas why it responds differently on bootup?

Cheers
# 2  
Old 10-09-2008
Sounds like your script is being run twice. The question is: why?
Prefix the echo command with something like:

Code:
pstree -h

Compare the first instance with the second. Maybe you'll learn that rc.local is being invoked twice somehow.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Bash script does not work as expected

Repeat this text in a file named notes.txt and run the script Before bash is a good language a blank line appears Also, the following notes are displayed incorrectly What is bad? ================================== Title : Note 1 ================================== Category: Computer Date... (3 Replies)
Discussion started by: cesar60
3 Replies

2. Shell Programming and Scripting

Bash script unable to disable expected output

I'm trying to understand why a script behaves different when run through a pipe. My OS: Linux myip 3.13.0-92-generic #139-Ubuntu SMP Tue Jun 28 20:42:26 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux This script (myscript.sh): #!/bin/bash echo whoami: whoami echo who: who echo who... (2 Replies)
Discussion started by: SkySmart
2 Replies

3. Shell Programming and Scripting

Apache tomcat startup script not booting at startup.

I copied the script from an AskUbuntu post - #!/bin/bash ### BEGIN INIT INFO # Provides: tomcat7 # Required-Start: $network # Required-Stop: $network # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start/Stop Tomcat server ### END INIT INFO ... (14 Replies)
Discussion started by: Hijanoqu
14 Replies

4. Shell Programming and Scripting

Getting error in bash script; expr $a + 1: integer expression expected

Hi, I am new to shell/bash script. I am trying to run below script #!/bin/bash a=0 b=10 if then echo "a is equal to be" else echo "a is not equal to be" fi MAX=10 while do echo $a a='expr $a + 1' done (1 Reply)
Discussion started by: Mallikgm
1 Replies

5. Shell Programming and Scripting

Need help with simple startup bash script in CentOS

Hi guys, I am very new to linux, so please bear with me. https://www.unix.com/./images/smilies/smile.png I need a simple script (bash / .sh) to start 2 programs at server startup. Both programs should run in a detached screen of their own. So basically: 1) start a detached screen with... (2 Replies)
Discussion started by: lastcrafters
2 Replies

6. Shell Programming and Scripting

Script to check for few conditions and respond with outputs

All, Here is what I am trying to accomplish: 1. Check for a file of specific name recursively and when I find it, a. if the file is more than 1hr old, no need to email or send notification, so just exit out from the shell script b. if the file is less than 1hr old, send an email to me saying... (3 Replies)
Discussion started by: pnara2
3 Replies

7. Shell Programming and Scripting

Bash won't exit as expected

Hi there, following code snippet should output nothing, IMHO. But the result is "THE END". #!/bin/bash if true ; thenexit fi | grep "somesearchstring" echo "THE END"using bash 4.1.9(1) Bug or feature? Hagen (5 Replies)
Discussion started by: montour
5 Replies

8. Shell Programming and Scripting

Using pipe in bash - is this the expected behaviour?

Hi all, Am trying to convert a script from ksh to bash :wall:. One of the sub is something like below: #!/bin/bash declare -a array01 step_01_test() { local count=0 ps -ef | grep watch | grep -v grep | awk '{ print $8 }' | while read line do let count=${count}+1 ... (1 Reply)
Discussion started by: newbie_01
1 Replies

9. Shell Programming and Scripting

bash script error with binary operator expected.

Hello, I am not sure, where I am missing in the scirpt, I am trying to grep few users from /etc/passwd file and if exists, I added line to echo as user exist, if not create it. #!/bin/bash for vid in v707 z307 z496 z163 z292 ; do if then echo " $vid User exists " else ... (2 Replies)
Discussion started by: bobby320
2 Replies

10. Shell Programming and Scripting

unzip via bash startup script problems

i have two lines in my rc.local file that are wget -O/<path>/<file>.zip url://domain.com unzip -o /<path>/<file>.zip the wget works fine, but the unzip won't work. when i copy/pase the unzip line to the prompt it works fine. i thought that maybe the unzip was running before the wget... (0 Replies)
Discussion started by: easysnowboards
0 Replies
Login or Register to Ask a Question