Sponsored Content
Top Forums Shell Programming and Scripting Script not waiting for user responce Post 302078909 by rdudejr on Wednesday 5th of July 2006 10:40:41 AM
Old 07-05-2006
Script not waiting for user responce

hi all,

Im fairly new to scripting and am having a noobish issue. Ive got a script that checks for certain directories and if they dont exist, prompts the user to do a mkdir. heres trouble spot in the script:


cat dirlsttemp.dat | while read dir; do

echo "$dir does not exist, would you like to create it now? (y or n)"
read responce
if [ $responce == "y" ];

then
mkdir $dir

else
echo "$dir has not been created"
fi
done
fi

what essentially happens is it does not wait for the responce and goes right to the else. i believe it has something to do with reading from the cat...but I dont know any other way to read that file line by line. Any solutions?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

read-waiting for user response

Would there be any reason for why a 'read ans' would not wait for a user's response (i.e user has to hit a key to continue)? I know for sure that it is doing everything else in that part of my 'if' statement but it doesn't wait for me to hit a key before continuing. The strange thing is that... (4 Replies)
Discussion started by: giannicello
4 Replies

2. UNIX for Dummies Questions & Answers

booting up but the system was waiting for user interaction at console

Hi all, My ssytem is mounted on a rack and not connected with any console. When I rebooted it remotely, it didn't go thru the bootup process. when I connect my laptop to the system locally and found that it was waiting for user interaction. Do you know how to disable it, so that it will boot... (1 Reply)
Discussion started by: stancwong
1 Replies

3. Shell Programming and Scripting

Help with script, shutdown if no ping responce

Hi, i would like to create a script that shuts down the system if the power fails, basicly the solaris box would load the script at startup. Ping 192.168.1.100 every 20 secs If cannot get responce 3 times in a row send init 0 to the system. Simple but effective, as 192.168.100.1 wont be on... (39 Replies)
Discussion started by: ringofsteel
39 Replies

4. UNIX for Advanced & Expert Users

Script Not waiting....plz help

Hi All: I am trying to call a multi-step script from a script. here is the code #!/usr/bin/ksh util.sh <<EOF connect dump EOF I am able to run the script but it is disconnecting before the dump job is finished. The script util.sh does not provide any functionality to wait... (9 Replies)
Discussion started by: laxman123
9 Replies

5. Shell Programming and Scripting

expect script hangs while waiting for the flag...

I am writing a script to check whether the root password is set to a special string on some solaris servers. Normally, the manually ssh login session is as below: $ ssh root@host1 Password: Last login: Wed Sep 16 13:53:28 2009 from 10.1.102.13 Sun Microsystems Inc. SunOS 5.10 ... (4 Replies)
Discussion started by: sleepy_11
4 Replies

6. Shell Programming and Scripting

SQL PLUS Command 'ACCEPT' is not waiting for user input with sh shell script

Dear All, The sqlplus 'Accept' command is not waiting for user input when I include the command within a shell script. Note: The 'Accept' command is working fine if I execute it in a SQLPLUS Prompt. Please fins the below sample script which i tried. SCRIPT: -------- #!... (4 Replies)
Discussion started by: little_wonder
4 Replies

7. Shell Programming and Scripting

how to grep the responce on TL1

Hi All, I'm a newbie here.. how can i grep the data when i receive responce from TL1 example: responce from TL1: blabalbalbalbalba.,lbalba,SUCCESFULL,blahblahbalabh... how can i grep the "SUCCESSFULL" while i'm running the script? is it possible? because i'm only to know is if... (2 Replies)
Discussion started by: nikki1200
2 Replies

8. Windows & DOS: Issues & Discussions

AutoSys Job not waiting for script to complete

I'm not sure if this is the right place to post this issue...but here goes... I am converting a set of windows jobs from Control-M to AutoSys r11.3. The same command line is being executed in both systems. The Control-M job runs to compltion in about 1.5 hours, waiting for the entire batch... (3 Replies)
Discussion started by: ajomarquez
3 Replies

9. Shell Programming and Scripting

Waiting for a process to complete in shell script

Hi, I need to initiate a process script which will start and do some processing and then shuts down. Then i need to other verifications. But the the process takes around 25 to 3o minutes. One thing i can monitor the nohup.out file for this process where i can wait for shutting down statement to... (3 Replies)
Discussion started by: Prashanth19
3 Replies

10. Shell Programming and Scripting

Shell read command is not waiting for user input

Hi, i am working on one automation , for that i have writing one shell program that take user input in "while read line" block. but read command is taking value that is readed by While block. while read line; do command 1; command 2 echo -n "Do you want to continute > " read rsp... (2 Replies)
Discussion started by: ranvijaidba
2 Replies
DIR(3)									 1								    DIR(3)

dir - Return an instance of the Directory class

SYNOPSIS
Directory dir (string $directory, [resource $context]) DESCRIPTION
A pseudo-object oriented mechanism for reading a directory. The given $directory is opened. PARAMETERS
o $directory - Directory to open o $context - Note Context support was added with PHP 5.0.0. For a description of contexts, refer to "Streams". RETURN VALUES
Returns an instance of Directory, or NULL with wrong parameters, or FALSE in case of another error. EXAMPLES
Example #1 dir(3) example Please note the fashion in which Directory.read(3)'s return value is checked in the example below. We are explicitly testing whether the return value is identical to (equal to and of the same type as - see Comparison Operators for more information) FALSE since otherwise, any directory entry whose name evaluates to FALSE will stop the loop. <?php $d = dir("/etc/php5"); echo "Handle: " . $d->handle . " "; echo "Path: " . $d->path . " "; while (false !== ($entry = $d->read())) { echo $entry." "; } $d->close(); ?> The above example will output something similar to: Handle: Resource id #2 Path: /etc/php5 apache cgi cli NOTES
Note The order in which directory entries are returned by the read method is system-dependent. PHP Documentation Group DIR(3)
All times are GMT -4. The time now is 09:25 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy