10-24-2006
Jean-Pierre, I really appreciate your help. What you've suggested is very close to what I am trying to achiveve with one difference only: the input is displayed only after return hit and I want it to be displayed after CTRL+D also,
i.e. asdfasdfasdfCTRL+D and I want the stdout to be asdfasdfasdf and to return to the console.
Can you tell me how to accomplish this?
10 More Discussions You Might Find Interesting
1. AIX
I wrote a ksh script for Helpdesk. I need to know how to disable ctrl-c,ctrl-z,ctrl-d..... so that helpdesk would not be able to get to system prompt :confused: (6 Replies)
Discussion started by: wtofu
6 Replies
2. UNIX for Dummies Questions & Answers
Hi
I was working on a shell script with randomly shows a page of text from a randomly selected topic .As soon as the page is displayed it callers a timer script which keeps on running indefinitely until the timer script is killed by the user.
This is where I have the problem,if I press... (2 Replies)
Discussion started by: mervin2006
2 Replies
3. Shell Programming and Scripting
I now that this isnt the greatest code around. Im a network guy by trade not a programer .. but needed something to compare config files ...
Anyway ... intermittently, the program terminates.
Ive been looking at the code for a week trying to figure it out and Im stumped. Can anyone provide... (0 Replies)
Discussion started by: popeye
0 Replies
4. Shell Programming and Scripting
Hi all, I connect with SSH connection to remote machine in the script and ı want to logout at half of the script then continue to script. If ı write exit in the script it terminates script not SSH connection. How can i do that please help me (1 Reply)
Discussion started by: fozay
1 Replies
5. Shell Programming and Scripting
Hi all , i know i ask a lot of question but these are really hard to solve and important question. I send two scripts:
expect.sh:
#!/usr/local/bin/expect
spawn ssh root@172.30.64.163
expect "login:"
send "root\n"
expect "password:"
send "root\n^M"
interact
and
son.sh:
... (2 Replies)
Discussion started by: fozay
2 Replies
6. Shell Programming and Scripting
H! I have written script where it need to invoke the perl script in background, then write the pid in temp file then bring back the job to foreground. whenever the Ctrl-C or Ctrl-Z is pressed in the script has to exit and prompt should be dispalyed. but this script causing exit from shell session... (2 Replies)
Discussion started by: jramesh1
2 Replies
7. UNIX for Advanced & Expert Users
Hi everyone,
I am new to the linux.I wrote a small script and assigning two values to fname and lname and I want if the fname or lname are not given proper name like Toys or Gun the script should terminate and if they are given proper name it should execute.please help thanks:wall:
#!/bin/bash... (4 Replies)
Discussion started by: starter2011
4 Replies
8. Shell Programming and Scripting
Hi,
while executing shell script, in the middle of the process, if we kill the shell script( ctrl+z or ctrl+c), script will be killed and the files which using for the script will be in the folder.
How to handle those scenarios. Is there any possibilities, if user breaks the script, I need to... (3 Replies)
Discussion started by: ckchelladurai
3 Replies
9. UNIX for Dummies Questions & Answers
Hi friends,
I am trying to add a newline char ('\n') between the query and the commit statement in the following shell script.
#! /bin/sh
echo "select * from tab; commit;" > data.sql
I have tried typing in "Ctrl-V + Ctrl-J" combination which has inserted ^@ (NUL) character but the commit... (1 Reply)
Discussion started by: royalibrahim
1 Replies
10. Shell Programming and Scripting
Hi..!
I'm stuck with my automation of starting a process and keeping it running even after the current ssh session has exited..
So i'm trying to use command 'screen'. which is doing exactly what i wanted, But the problem is automation of the same.
i will have to press Ctrl+a and Ctrl+d for... (2 Replies)
Discussion started by: chandana hs
2 Replies
LEARN ABOUT NETBSD
cnpollc
CONS(9) BSD Kernel Developer's Manual CONS(9)
NAME
cnbell, cnflush, cngetc, cngetsn, cnhalt, cnpollc, cnputc -- console access interface
SYNOPSIS
#include <dev/cons.h>
void
cnbell(u_int pitch, u_int period, u_int volume);
void
cnflush(void);
int
cngetc(void);
int
cngetsn(char *cp, int size);
void
cnhalt(void);
void
cnpollc(int on);
void
cnputc(int c);
DESCRIPTION
These functions operate over the current console device. The console must be initialized before these functions can be used.
Console input polling functions cngetc(), cngetsn() and cnpollc() are only to be used during initial system boot, e.g., when asking for root
and dump device or to get necessary user input within mountroothooks. Once the system boots, user input is read via standard tty(4) facili-
ties.
The following is a brief description of each function:
cnbell() Ring a bell at appropriate pitch, for duration of period milliseconds at given volume. Note that the volume value is ignored com-
monly.
cnflush() Waits for all pending output to finish.
cngetc() Poll (busy wait) for an input and return the input key. Returns 0 if there is no console input device. cnpollc() must be called
before cngetc() could be used. cngetc() should be used during kernel startup only.
cngetsn() Read one line of user input, stop reading once the newline key is input. Input is echoed back. This uses cnpollc() and cngetc().
Number of read characters is size at maximum, user is notified by console bell when the end of input buffer is reached.
<Backspace> key works as expected. <@> or <CTRL>-u make cngetsn() discard input read so far, print newline and wait for next
input. cngetsn() returns number of characters actually read, excluding the final newline. cp is not zero-ended before return.
cngetsn() should be used during kernel startup only.
cnhalt() Terminates the console device (i.e. cleanly shuts down the console hardware.)
cnpollc() Switch the console driver to polling mode if on is nonzero, or back to interrupt driven mode if on is zero. cnpollc() should be
used during kernel startup only.
cnputc() Console kernel output character routine. Commonly, kernel code uses printf(9) rather than using this low-level interface.
EXAMPLES
This waits until a <Enter> key is pressed:
int c;
cnpollc(1);
for(;;) {
c = cngetc();
if ((c == '
' || (c == '
')) {
printf("
");
break;
}
}
cnpollc(0);
SEE ALSO
pckbd(4), pcppi(4), tty(4), wscons(4), wskbd(4), printf(9), spl(9), wscons(9)
BSD
June 8, 2010 BSD