Sponsored Content
Top Forums Shell Programming and Scripting While read won't run keyboard function Post 303022173 by annacreek on Sunday 26th of August 2018 07:48:53 PM
Old 08-26-2018
While read won't run keyboard function

I am using while read do/ done to retrieve menu item.

Works as advertised, no problem.

I am using this hack function "pause" to stop script execution and wait for keyboard "enter" key to continue. Sort of break point function. Also works fine with one exception - it does not work when used within while do/done code.



No big issue, but like to know what so special with while do /cone code.



As far as I can tell I get no error or tracking info telling me why "pause" no longer waits for (any) key press. It just "passes thru " .





In this stripped down code I experience same problem when using "pause" in "inputBox" function



Code:
                         while read choice
  do
  echo $choice
  inputBox
  pause                # will  not wait for keyboard  
   done < results


Here is partial output , no need to press "enter"



Code:
@line 463 Execute pause function 
+ pause
+ read -p 'Press [Enter] key to continue...'   

  code executed in "pause"  function 



 + echo '@line 466 Execute pause function '
@line 466 Execute pause function

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Why won't my script run?

On the following script that I get an error when I try to execute as root: #./mv_log.sh bash: /root/util/mv_log.sh: Permission denied #!/usr/bin datetag=`date --date='1 day ago' +"%b%d%Y"` logname=`find /opt/bea/wlserver6.1/config/*/logs/ -iname 'access.log0*' -mtime -1 -print` mv... (4 Replies)
Discussion started by: darthur
4 Replies

2. UNIX for Dummies Questions & Answers

Cron won't run properly

I am new to unix, and this is my 1st post on this board. Looking for some advice about a cron job in my server. I am running a cron task that references a script which runs several other scripts and compiles them into a report and emails it to me. If I run the script manually, I will... (2 Replies)
Discussion started by: Steeler_fan
2 Replies

3. UNIX for Dummies Questions & Answers

Made command into a script but now won't run

Hello, After seeing in a Unix cheatsheet that I could add commands into a file and run that file as a command to save on typing, i tried it with this: #! /bin/csh # Backup website excluding directories that do not change rsync -e "ssh -p 2222" -axzvc --progress --stats --compress-level=9... (9 Replies)
Discussion started by: patwa
9 Replies

4. Solaris

smc won't run on a regular user

Hi All, I'm getting this all the time with a regular user (after I do su - and smc): It appears you are attempting to run the graphical Solaris Management Console from a terminal which does not have a suitable 'DISPLAY' environment. Please check your 'DISPLAY' settings and that the user... (5 Replies)
Discussion started by: itik
5 Replies

5. Ubuntu

Toshiba Laptop Won't Run Bluetooth with Ubuntu

I am running Ubuntu 8.1 on a Toshiba Satellite P105-S9337 with built-in Bluetooth hardware. I cannot get the Bluetooth hardware to work with my Microsoft Bluetooth mouse. I have installed the tosh software with no luck. Does anyone have an idea as to what to try. I have several kernel mods... (0 Replies)
Discussion started by: tjloeb
0 Replies

6. SCO

SCO 6.0-Keys in keyboard function differently

Sir I have HP installed with SCO 6.0. The problems are (1) some keys in board like 'del' 'backspace', 'pageup/dn" do not function and display some special characters on conole. (2) Files transferred from Windows machine invariably contain control Z/M characters. How to resolve these issues. ... (4 Replies)
Discussion started by: chssastry
4 Replies

7. UNIX for Dummies Questions & Answers

read from terminal/keyboard > /dev/tty

Hi, I need to provide more than one character to "> /dev/tty" through terminal/keyboard input, I have this: ok=false while do echo " Enter r1 to reformat " > /dev/tty read choice case $choice in ) echo " bla bla bla " ;; done However, in this way,... (3 Replies)
Discussion started by: Gery
3 Replies

8. HP-UX

CDE Login on console won't use keyboard

Hi all, I'm installing a HP r2660 machine with HP-UX 11.23 (this version fixed by customer's product) and I've troubles using the VGA console as workstation display. At first it worked just as TEXT console, then I fixed /etc/dt/config/Xservers and now I've the CDE prompt for login. ... (5 Replies)
Discussion started by: larry100
5 Replies

9. Shell Programming and Scripting

Run command if no mouse or keyboard input

I would like a script that would run pm-suspend if there has been no keyboard or mouse input for a specified time. ------ Post updated at 11:17 AM ------ Never mind. I found a setting in power management that does what I need. (0 Replies)
Discussion started by: drew77
0 Replies

10. UNIX for Beginners Questions & Answers

Bash script won't run because hardware won't produce display

Can anyone offer any advice on how to modify the script below to work on a new system we have, that has no graphics capability? We admin the system through a serial RAS device. I've tried running the below script through the RAS and through an ssh -X session. It failed with something like "GTK... (3 Replies)
Discussion started by: yelirt5
3 Replies
pause(3)						     Library Functions Manual							  pause(3)

NAME
pause - Suspends a process until it receives a signal LIBRARY
Standard C Library (libc.so, libc.a) SYNOPSIS
#include <unistd.h> int pause( void ); STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: pause(): POSIX.1, XPG4, XPG4-UNIX Refer to the standards(5) reference page for more information about industry standards and associated tags. DESCRIPTION
The pause() function suspends the calling process until it receives a signal whose action is either to execute a signal-catching function or terminate the process. The signal must be one that is acknowledged by the calling process. The pause() function does not affect the action taken when a signal is received. The pause() function suspends the calling process by suspending the calling thread. Other threads in the process, if any, are not sus- pended. RETURN VALUES
When the received signal causes the calling process to terminate, the pause() function does not return. When the signal is caught by the calling process and control is returned from the signal-catching function, the calling thread resumes exe- cution from the point of suspension. At that point, the pause() function returns a value of -1 and sets errno to indicate the error. ERRORS
The pause() function sets errno to the specified values for the following conditions: The signal has been caught by the calling process and control has been returned from the signal-catching function. RELATED INFORMATION
Functions: kill(2), sigaction(2), sigvec(2), wait(2) Routines: alarm(3) Standards: standards(5) delim off pause(3)
All times are GMT -4. The time now is 09:48 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy