I am trying to create a shell (ksh) which has two "read" commands, one which reads a line from a file and another which is inside a loop that reads user input from a keyboard. However, the "read" command inside the loop uses the input from the file and it does not get the user input from keyboard.... (3 Replies)
Hello all,
How can i have a user input that reads like this:
echo -n "Please enter a & b:" 10 20
read a
read b
echo $a
echo $b
10
20
right now i have divided it into two echos, like
echo -n "a: "
echo -n "b: " (1 Reply)
I'm trying to set up a script that takes user input and validates that the user input was entered correctly.
So far I have this:
while :
do
echo "Please enter your name."
read NAME
if
then
echo "You have not entered a name."
echo... (13 Replies)
If I want all user input to start with " : " if not display error
or what I asking is how to do if statement that control a first letter of string that we want to start with. and not worry about the rest
Thank (1 Reply)
Hi,
echo "Enter file name of input file list along with absolute path : "
read inputFileList
if
then
for string in `cat inputFileList`
do
echo $string
done
else
echo " file does not exist"
fi
From the above code, if the user enters a invalid file... (1 Reply)
i have a script which takes input from user, if user gives either Y/y then it should continue, else it should quit by displaying user cancelled.
#!/bin/sh
echo " Enter your choice to continue y/Y OR n/N to quit "
read A
if
then
echo " user requested to continue "
##some commands... (7 Replies)
$Input_filename=$ARGV;
if (!-d $Input_filename && ! -e $Input_filename)
{
print "USAGE: Please enter '$ABCD/def/dsed.txt' as an arguement \n";
exit;
}
1. Input Is suppose to be something like "$ABCD/def/dsed.txt".
if the input is wrong the script should throw an ERROR message.... (2 Replies)
Why does removing "rhgb quiet" from the kernel boot parameters control whether or not the commands I enter are displayed in single user mode ?
For instance, if I do not remove "rhgb quiet", when I am in single user mode, whatever command I type will not be displayed on the screen.
The... (0 Replies)
I am trying to allow a user to enter in text and then store that text in a variable $gene to run in an awk command in which those values are used to run some calculations. I am getting syntax errors however, when I try. Thank you :).
The awk runs great if it is a pre-defined file that is used,... (7 Replies)
Discussion started by: cmccabe
7 Replies
LEARN ABOUT MINIX
stty
STTY(1) General Commands Manual STTY(1)NAME
stty - set terminal parameters
SYNOPSIS
stty [-ag]
stty encoded-form
stty speed ispeed speed ospeed speed cs5 cs6 cs7 cs8 [-]parenb [-]parodd [-]hupcl [-]cstopb [-]cread [-]clocal [-]ignbrk [-]brkint [-]ign-
par [-]parmrk [-]inpck [-]istrip [-]inlcr [-]igncr [-]icrnl [-]ixon [-]ixoff [-]ixany [-]opost [-]onlcr [-]xtabs [-]onoeot [-]isig
[-]icanon [-]iexten [-]echo [-]echoe [-]echok [-]echonl [-]noflsh [-]lflusho eof=c eol=c erase=c erase=c intr=c kill=c quit=c susp=c
start=c stop=c rprnt=c lnext=c flush=c min=n time=n rows n cols n cooked raw [-]evenp [-]parity [-]oddp [-]nl ek sane
DESCRIPTION
Stty shows or changes the parameters of the terminal connected to standard input. Stty takes a myriad of arguments most of which are
mapped directly to the flags and special characters described in tty(4), so we won't describe them here.
Stty has three forms of operation. First, without any arguments stty shows all terminal attributes that are different from the default
state. Option -a makes stty print all terminal attributes, and -g lets stty print the attributes in a special encoded form, a simple row
of colon separated hexadecimal numbers.
In the second form of operation stty takes an encoded form as produced by the -g option and sets the terminals attributes to its decoded
value.
In the third form stty interprets a series of flags and parameters settings and modifies the terminal attributes accordingly. Flags can be
given as icanon or -icanon for instance, either setting or clearing the ICANON flag. Special character values can by set like intr=^C for
example, which sets the interrupt character to CTRL-C. You can either use a real CTRL-C, or the two characters `^' and `C'. In any case
it is probably necessary to use quotes to guard it from the shell: intr='^C'.
A number alone is interpreted as a baud rate setting for both the input and output rate. The input or the output rate can be set sepa-
rately with use of the ispeed and ospeed prefixes to the number. The character size can be set with cs5, cs6, cs7 or cs8.
The MIN and TIME value, and the number of rows and columns of the window can also be set using one of the keywords min, time, rows or cols,
followed by a decimal number that is the value of the setting.
Stty accepts several keywords that are not named by corresponding flags or parameters in tty(4). They set several attributes at once:
cooked Same as icrnl ixon opost onlcr isig icanon iexten echo, setting all the attributes that are needed for line oriented mode.
raw Same as -icrnl -ixon -opost -onlcr -isig -icanon -iexten -echo, setting all the attributes for a raw data channel.
evenp parity
These synonyms are equal to cs7 parenb -parodd, setting the line to 7 bits even parity.
oddp Same as cs7 parenb parodd, setting the line to 7 bits odd parity.
-parity -evenp -oddp
All synonyms for cs8 -parenb, setting the line to 8 bits, no parity.
nl Same as icrnl, setting carriage return to line feed input translation.
-nl Same as -icrnl -inlcr -igncr, disabling any carriage return or line feed handling.
ek Set the ERASE and KILL special characters back to the default.
sane Set all attributes to the default except things like the line speed and parity, because their "sane" value is probably what it is
right now. The default values are compiled into stty from the <termios.h> include file. Use stty sane; stty -a to know what they
are.
FILES
/etc/ttytab The init field of this file may contain an stty command to set the attributes to match an attached RS232 terminal or modem.
SEE ALSO tty(4), ttytab(5).
NOTES
The cooked, raw, rows and cols keywords are Minix additions beyond the keywords defined by POSIX. Rows and cols are common UNIX exten-
sions, however. There are more Minix specific flags that match the Minix specific attributes described in tty(4).
AUTHOR
Kees J. Bot (kjb@cs.vu.nl)
STTY(1)