02-23-2012
I can not get it to work as it builds on that it comes data on file 'server.log' for the program to get to the prompt and there is no steady stream of data on that file.
Quote:
Originally Posted by
Corona688
Yes, it will block.
Since it's bash, you could have it time out eventually if the user doesn't type anything ( read -t 1 userinput < /dev/tty )
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi,
The gcc compiler has warned about using gets(), so I've been trying my hand at getline.
Problem is that I've been able to read from a file, but what I really need is to read from a user's input.
I want to use getline like a scanf() command, but I can't figure what to substitute for the fp... (6 Replies)
Discussion started by: sdsd
6 Replies
2. UNIX for Dummies Questions & Answers
Hiii
I wanna a read a line of text from standard input. The user enter data like this way
name phone_no month1_salary month2_salary
that is user enter the name ,phone no and salary of 2 months in a single line by giving spaces. I wanna add the 3rd and 4th fields ...ie add both... (4 Replies)
Discussion started by: krishnampkkm
4 Replies
3. Shell Programming and Scripting
I am trying to script simply data transfer. I would like to have the user input the source "SRC" (/Volumes/DriveName/Users/johnq123) and then name the directory that the copied information will go to, "DST" . put I can't get it to work -
#!/bin/bash
... (8 Replies)
Discussion started by: dropkick888
8 Replies
4. AIX
Hi All,
I am working on a script which requires an input from user within one 1 min.
So if the user gives the required input within 1 min., it will execute on the basis of input provided by the user.Other wise it will execute on a default value(hard coded inside the script).
Now, I am... (19 Replies)
Discussion started by: rajsharma
19 Replies
5. Shell Programming and Scripting
I need to write a bourne shell script (solaris 10) that accepts input from the user. The input will be a command- any command like ls/ pwd/ mv etc. After the input is read, the shell must execute the command supplied by the user.
I know we use read to play with user inputs. Just not sure how to... (2 Replies)
Discussion started by: PDManc
2 Replies
6. Shell Programming and Scripting
Below is a simple script to prompt for user input while suggesting an editable default value at the prompt:
shortname=user1
read -e -i $shortname -p "Please enter the username you would like to add: " input
USERNAME="${input:-$shortname}"
Please enter the username you would like to add:... (3 Replies)
Discussion started by: woodson2
3 Replies
7. Shell Programming and Scripting
Hello.
I am running 2 scripts : script_1 and script_2
These scripts are run as root
Script 2 contains :
#!/bin/bash
#
# ~/bin/script_2
#
E_BAD_PARAM=115
#
date2stamp () {
date --date "$1" +%Y-%m-%d___%H:%M:%S
}
#
USER_NAME=$1
NB_PARAM=$#
PARAM0=$0 (2 Replies)
Discussion started by: jcdole
2 Replies
8. Shell Programming and Scripting
I am creating a bash that uses perl . The below code closes before the input is entered. If I run the perl as a .pl it is fine. What am I doing wrong? Thank you :).
#!/bin/bash
cd 'C:\Users\cmccabe\Desktop\wget'
wget -O getCSV.txt http://xxx.xx.xxx.xxx/data/getCSV.csv
print... (4 Replies)
Discussion started by: cmccabe
4 Replies
9. Shell Programming and Scripting
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
10. Shell Programming and Scripting
Hi,
This query is a part of a much more lengthy script.
I wish to look for all the files in a folder named "data" which in this case has two files i.e. plan.war and agent.properties. For all the files found under data I wish to ask the user as to where they wish copy the files to.
Below,... (14 Replies)
Discussion started by: mohtashims
14 Replies
LEARN ABOUT CENTOS
ttysnoop
TTYSNOOP(8) BSD System Manager's Manual TTYSNOOP(8)
NAME
ttysnoop -- snoop on a user's tty
SYNOPSIS
ttysnoop [pty]
ttysnoops
DESCRIPTION
The ttysnoop / ttysnoops client-server combo can be used to snoop (watch) on a user's login tty. The server (ttysnoops) is usually started
by getty(8) or telnetd(8) and reads the file /etc/snooptab to find out which tty's should be cloned and which programs to run on them (usu-
ally /bin/login). A tty may be snooped through a pre-determined (ie. fixed) device, or through a dynamically allocated pseudo-tty (pty).
This is also specified in the /etc/snooptab file. To connect to the pty, the client ttysnoop should be used. The available pseudo terminals
pty are present as sockets in the directory /var/spool/ttysnoop/.
Format of /etc/snooptab
The /etc/snooptab file may contain comment lines (starting with a '#'), empty lines, or entries for tty's that should be snooped upon. The
format of such an entry is as follows:
tty snoop-device type program
where tty is the leaf-name of the tty that should be snooped upon (eg. ttyS2, not /dev/ttyS2) OR the wildcard '*', which matches ANY tty.
snoop-device is the device through which tty should be snooped (eg. /dev/tty8) OR the literal constant "socket". The latter is used to tell
ttysnoops that the snoop-device will be a dynamically allocated pty. type specifies the type of program that should be run, currently recog-
nized types are "init", "user" and "login" although the former two aren't really needed. Finally, program is the full pathname to the program
to run when ttysnoops has cloned tty onto snoop-device.
EXAMPLE
The following example /etc/snooptab file should illustrate the typical use of ttysnoop / ttysnoops:
#
# example /etc/snooptab
#
ttyS0 /dev/tty7 login /bin/login
ttyS1 /dev/tty8 login /bin/login
#
# the wildcard tty should always be the last one in the file
#
* socket login /bin/login
#
# example end
#
With the above example, whenever a user logs in on /dev/ttyS0 or /dev/ttyS1, either tty will be snooped through /dev/tty7 or /dev/tty8
respectively. Any other tty's will be snooped through a pty that will be allocated at the time of login. The system-administrator can then
run ttysnoop pty to snoop through the pty. Note that it is up to the system-administrator to setup getty and/or telnetd so that they execute
ttysnoops instead of /bin/login.
SEE ALSO
getty(8), telnetd(8)
FILES
/etc/snooptab
BUGS
The program is unable to do any terminal control-code translations for the original tty and the snoop-device. I doubt it will ever do this.
AUTHOR
Carl Declerck, carl@miskatonic.inbe.net
BSD August 8 1994 BSD