04-29-2013
You can prompt the user with echo or printf, and read text via read VARNAME
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
hi all,
I'm trying to resolve a scenario where we prompt the user to enter 1 or more disk names.
From there we would run a command on each disk which would give its location.
This would allow us to create a list of disks at location A, a list of disks at location B,....etc...
Any help... (1 Reply)
Discussion started by: annie
1 Replies
2. AIX
Hi Guys,
I want to create user with a script:
user name, user id, primary group, group set, home directory, initial program, password, user information, another user can SU to user. And all the rest is the default.
Does anyone already have the script for this? Can you please share it... (8 Replies)
Discussion started by: itik
8 Replies
3. Shell Programming and Scripting
Hi,
I need to get the user input and execute a particular script based on the input provided.
For E.g. When I execute the script say Test.sh it should prompt "For which country I need to execute the script? (US/India)"
Based on the input as US or India from the user the execution of... (8 Replies)
Discussion started by: yoursdavinder
8 Replies
4. Shell Programming and Scripting
I'm working on making a menu system on an HP-UX box with Bash on it. The old menu system presents the users with a standard text menu with numbers to make selections. I'm re-working the system and I would like to provide something more akin to iterative search in Emacs.
I have a list of 28... (2 Replies)
Discussion started by: deckard
2 Replies
5. Shell Programming and Scripting
Hi ,
I want to write a shell script that can create oracle database user and grants permission to this user.
Thanks & Regards,
Deepak (4 Replies)
Discussion started by: Deepakjha
4 Replies
6. Shell Programming and Scripting
Hello
I am trying to create a user input shell scipt. The objective is user should enter the circuit number and the input is saved in a log file. If the user does not enter anything then the question should prompt it until the circuit no. is entered.
Can any one please correct the code below.... (3 Replies)
Discussion started by: sureshcisco
3 Replies
7. Shell Programming and Scripting
Hi Jim,
I have following script,i which i need to take dynamic value .
script,
nawk -v v1=grep"INT_EUR" $propertifilename | cut -d"=" -F2` -F'~' '{if (NF-1 !=v1)
{print "Error in " $0 " at line number "NR" tilde count " N-1}}' $filename
In the above script i want to use INT_EUR as a variable... (2 Replies)
Discussion started by: Ganesh Khandare
2 Replies
8. Shell Programming and Scripting
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)
Discussion started by: only4satish
7 Replies
9. UNIX for Dummies Questions & Answers
Hi All,
I am really new to Linux.I am trying to write a script for creating a new directory by getting input of folder name from the user.Please help me in this regard.
#! /bin/bash
echo "Enter name of dir":$filename
mkdir -p $filename
When executing this I am getting following error
... (13 Replies)
Discussion started by: Pradeep_1990
13 Replies
10. Shell Programming and Scripting
Hi everyone, I'm new here and just a beginner in linux scripting.
Just want to ask for help on this one.
I am trying to create a script that will accept user input (year-month and user/s).
I wanted to have the script to continue running, until the user inputs a DATE and name/s of user/s. ... (2 Replies)
Discussion started by: Helskadi
2 Replies
LEARN ABOUT OSX
readpassphrase
READPASSPHRASE(3) BSD Library Functions Manual READPASSPHRASE(3)
NAME
readpassphrase -- get a passphrase from the user
SYNOPSIS
#include <readpassphrase.h>
char *
readpassphrase(const char *prompt, char *buf, size_t bufsiz, int flags);
DESCRIPTION
The readpassphrase() function displays a prompt to, and reads in a passphrase from, /dev/tty. If this file is inaccessible and the
RPP_REQUIRE_TTY flag is not set, readpassphrase() displays the prompt on the standard error output and reads from the standard input. In
this case it is generally not possible to turn off echo.
Up to bufsiz - 1 characters (one is for the NUL) are read into the provided buffer buf. Any additional characters and the terminating new-
line (or return) character are discarded.
The readpassphrase() function takes the following optional flags:
RPP_ECHO_OFF turn off echo (default behavior)
RPP_ECHO_ON leave echo on
RPP_REQUIRE_TTY fail if there is no tty
RPP_FORCELOWER force input to lower case
RPP_FORCEUPPER force input to upper case
RPP_SEVENBIT strip the high bit from input
The calling process should zero the passphrase as soon as possible to avoid leaving the cleartext passphrase visible in the process's address
space.
RETURN VALUES
Upon successful completion, readpassphrase() returns a pointer to the null-terminated passphrase. If an error is encountered, the terminal
state is restored and a NULL pointer is returned.
FILES
/dev/tty
EXAMPLES
The following code fragment will read a passphrase from /dev/tty into the buffer passbuf.
char passbuf[1024];
...
if (readpassphrase("Response: ", passbuf, sizeof(passbuf),
RPP_REQUIRE_TTY) == NULL)
errx(1, "unable to read passphrase");
if (compare(transform(passbuf), epass) != 0)
errx(1, "bad passphrase");
...
memset(passbuf, 0, sizeof(passbuf));
SIGNALS
The readpassphrase() function will catch the following signals:
SIGINT
SIGHUP
SIGQUIT
SIGTERM
SIGTSTP
SIGTTIN
SIGTTOU
When one of the above signals is intercepted, terminal echo will be restored if it had previously been turned off. If a signal handler was
installed for the signal when readpassphrase() was called that handler is then executed. If no handler was previously installed for the sig-
nal then the default action is taken as per sigaction(2).
The SIGTSTP, SIGTTIN, and SIGTTOU signals (stop signal generated from keyboard or due to terminal I/O from a background process) are treated
specially. When the process is resumed after it has been stopped, readpassphrase() will reprint the prompt and the user may then enter a
passphrase.
ERRORS
[EINTR] The readpassphrase() function was interrupted by a signal.
[EINVAL] The bufsiz argument was zero.
[EIO] The process is a member of a background process attempting to read from its controlling terminal, the process is ignoring
or blocking the SIGTTIN signal or the process group is orphaned.
[EMFILE] The process has already reached its limit for open file descriptors.
[ENFILE] The system file table is full.
[ENOTTY] There is no controlling terminal and the RPP_REQUIRE_TTY flag was specified.
SEE ALSO
sigaction(2), getpass(3)
STANDARDS
The readpassphrase() function is an extension and should not be used if portability is desired.
HISTORY
The readpassphrase() function first appeared in OpenBSD 2.9.
BSD
December 7, 2001 BSD