Sponsored Content
Full Discussion: read from console in ksh
Top Forums Shell Programming and Scripting read from console in ksh Post 302154180 by ajaykumarns on Friday 28th of December 2007 09:03:55 AM
Old 12-28-2007
Question read from console in ksh

I am stuck with a problem while reading data from a file..

while [ 1 ]
do
read line
#do some operations and if some condition is satisfied, ask the user to enter his choice.
# using the choice continue operations.
done < fileBeingRead.txt

The problem is, when i am inside the while loop, I am not able to read data from the console/terminal. Is there any way to temporarily read data from console? and then continue looping ?
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How do i access (mount, read & write) a floppy disk from the console, not being root?

welll, the title quite explains what i want to do thanks for your time! (4 Replies)
Discussion started by: kfaday
4 Replies

2. Shell Programming and Scripting

ksh read timeout

any idea on how to timeout the read statement for ksh? for bash u can use read -t option -t timeout Cause read to time out and return failure if a complete line of input is not read within timeout seconds. This option has ... (2 Replies)
Discussion started by: ashterix
2 Replies

3. Shell Programming and Scripting

is there any way to read a line twice in KSH

Hi All, Is there any way to read the previous line in file reading ? or is there any way to read a line twice in KSH ? thanks in advance !! Srini (6 Replies)
Discussion started by: Srini75
6 Replies

4. UNIX for Dummies Questions & Answers

simple way to read an array in ksh

hi, I'm a newbie to shell scripting. I wanted to initialise an array using basic for loop and read it. Then i want to print it as a .CSV file.. Any help would me much appreciated.. (1 Reply)
Discussion started by: pravsripad
1 Replies

5. Shell Programming and Scripting

Read from Log file in Ksh

I have a log file like.. IMPORT from /dataserver/ftp/bits/mdr/mdr_data_discon.dat OF DEL ..... Number of rows read = 1376 Number of rows skipped = 0 Number of rows inserted = 1374 Number of rows updated = 0 Number of rows rejected = 2 Number of rows... (4 Replies)
Discussion started by: ramse8pc
4 Replies

6. UNIX for Dummies Questions & Answers

Question with read command in ksh

Hi, I was writing a script to accept input using read. When I put !#/usr/bin/ksh in the beginning of the script, it accepts only 258 characters. And I remove it, it accepts more. I'm wondering what the difference is. Thanks in advance, (7 Replies)
Discussion started by: swmk18
7 Replies

7. Shell Programming and Scripting

Read a multiline text from a console - supporting arrow keys

Hi, I try to read a multiline text from a console and write it to a file using a bash script. I want to end reading from a console if a user types the key twice. I tried this loop: while read LINE; do if 2>/dev/null; then break fi echo -e ${LINE} >> $file done However, it doesn't... (8 Replies)
Discussion started by: wenclu
8 Replies

8. Shell Programming and Scripting

ksh while read issue

Hello, I have used a chunk of ksh script similar to this in many places without any issue: while : do print; read OPTION?"Enter a number (q to quit): " expr ${OPTION} + 1 >/dev/null 2>&1 CHECKVAL=$? if }" != ${OPTION} ]; then ... (2 Replies)
Discussion started by: port43
2 Replies

9. Shell Programming and Scripting

While read -a line not working in ksh

while read -a line; this is not working in ksh. what is the equivalent of this in ksh. read: -a: unknown option (2 Replies)
Discussion started by: archana25
2 Replies

10. Programming

Read in numbers from console won't stop at newline.

Hello, I have snippet code from Lippman's <<C++ primer>>. The program is to convert regular decimal (0 ~ 15) numbers to basic hexdecimals. The instruction tells the program will execute by hitting newline at the end. When I tried to run the compiled program, hitting ENTER did not work as... (3 Replies)
Discussion started by: yifangt
3 Replies
INIT(8) 						      System Manager's Manual							   INIT(8)

NAME
init - process control initialization SYNOPSIS
/etc/init DESCRIPTION
Init is invoked inside UNIX as the last step in the boot procedure. It normally then runs the automatic reboot sequence as described in reboot(8), and if this succeeds, begins multi-user operation. If the reboot fails, it commences single user operation by giving the super- user a shell on the console. It is possible to pass parameters from the boot program to init so that single user operation is commenced immediately. When such single user operation is terminated by killing the single-user shell (i.e. by hitting ^D), init runs /etc/rc with- out the reboot parameter. This command file performs housekeeping operations such as removing temporary files, mounting file systems, and starting daemons. In multi-user operation, init's role is to create a process for each terminal port on which a user may log in. To begin such operations, it reads the file /etc/ttys and executes a command for each terminal specified in the file. This command will usually be /usr/libexec/getty. Getty opens and initializes the terminal line, reads the user's name and invokes login to log in the user and execute the Shell. Ultimately the Shell will terminate because of an end-of-file either typed explicitly or generated as a result of hanging up. The main path of init, which has been waiting for such an event, wakes up and removes the appropriate entry from the file utmp, which records cur- rent users, and makes an entry in the wtmp, file which maintains a history of logins and logouts. The wtmp entry is made only if a user logged in successfully on the line. Then the appropriate terminal is reopened and getty is reinvoked. Init catches the hangup signal (signal SIGHUP) and interprets it to mean that the file /etc/ttys should be read again. The Shell process on each line which used to be active in ttys but is no longer there is terminated; a new process is created for each added line; lines unchanged in the file are undisturbed. Thus it is possible to drop or add terminal lines without rebooting the system by changing the ttys file and sending a hangup signal to the init process: use `kill -HUP 1.' Init will terminate multi-user operations and resume single-user mode if sent a terminate (TERM) signal, i.e. ``kill -TERM 1''. If there are processes outstanding which are deadlocked (due to hardware or software failure), init will not wait for them all to die (which might take forever), but will time out after 30 seconds and print a warning message. Init will cease creating new getty's and allow the system to slowly die away, if it is sent a terminal stop (TSTP) signal, i.e. ``kill -TSTP 1''. A later hangup will resume full multi-user operations, or a terminate will initiate a single user shell. This hook is used by reboot(8) and halt(8). Init's role is so critical that if it dies, the system will reboot itself automatically. If, at bootstrap time, the init process cannot be located, the system will loop in user mode at location 0x13. DIAGNOSTICS
/usr/libexec/getty gettyargs failing, sleeping. A process being started to service a line is exiting quickly each time it is started. This is often caused by a ringing or noisy terminal line. Init will sleep for 30 seconds, then continue trying to start the process. WARNING: Something is hung (wont die); ps axl advised. A process is hung and could not be killed when the system was shutting down. This is usually caused by a process which is stuck in a device driver due to a persistent device error condition. FILES
/dev/console, /dev/tty*, /var/run/utmp, /usr/adm/wtmp, /etc/ttys, /etc/rc SEE ALSO
login(1), kill(1), sh(1), ttys(5), crash(8), getty(8), rc(8), reboot(8), halt(8), shutdown(8) 4th Berkeley Distribution November 27, 1996 INIT(8)
All times are GMT -4. The time now is 05:48 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy