04-08-2020
Please always add info on your system, like OS and shell versions, and the (relevant part of the) script as well, to keep people from guessing.
My guess is you're using
bash's
read -p builtin.
man bash:
Quote:
read
.
.
.
-p prompt
Display prompt on standard error, without a trailing newline, before attempting to read any input. The prompt is displayed only if input is coming from a terminal.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
how do I use a file (comma seperated) as an input for a script in bin/sh?
e.g.
I have a script that :
Input1=$1
Input2=$2
Input3=$3
Input4=$4
echo "$Input1, $Input2, $Input3,$Input4" (or some other function)
If I have a .csv file which lists many rows of input:
joe,5,john,10... (1 Reply)
Discussion started by: finster
1 Replies
2. Shell Programming and Scripting
#!/bin/sh
rpt="/export/home/legato/rpt_offsite"/test_eject.tape
cat <$rpt
while read line
do
echo $line
perform routine
done
I am trying to read the contents of this file line by line and perform a routine for each line read.
The file contents are numbers..
What is wrong with my... (1 Reply)
Discussion started by: gzs553
1 Replies
3. Shell Programming and Scripting
Hi,
I have an expect script that logs into a host (via ssh) requests the hostid then exits... I am happy with that.
However how can I run the same script in a kind of 'while read line' and enter lots of hosts? My knowledge is still very limited (as you will soon see) so any other ideas would... (2 Replies)
Discussion started by: starsky
2 Replies
4. Shell Programming and Scripting
Hi all
As quite newbie in shell scripting i need your help.
The case: two files with question mark delimeter:
file1.txt:
A; B; D; E;
file2.txt:
a,antonis,red; b,maria,green; c,george,blue; d,jack,red; e,Helen,yellow; k,konstantin,black;
I need an effiecient way of parsing while it... (2 Replies)
Discussion started by: forumsgr
2 Replies
5. Shell Programming and Scripting
All,
I am trying to figure out a script to run in windows that will allow me to match on First column in file1 to 8th Column in File2 then
Insert file1 column2 to file2 column4 then create a new file.
File1:
12345 Sam
12346 Bob
12347 Bill
File2:... (1 Reply)
Discussion started by: darkoth
1 Replies
6. Shell Programming and Scripting
Hi All,
I am hoping someone can help me with some scripting I need to complete using AWK.
I'm trying to process multiple fixed files to generate one concatenated fixed file in a standard format.
The Input file is:-
aaaa bbbbb ccccc 1 xxxx aaa bbb
aaaa bbbbb ccccc 2 abcd aaa CCC... (9 Replies)
Discussion started by: jason_v_brown
9 Replies
7. Shell Programming and Scripting
Hi,
I have this script
Script.sh:
#!/bin/sh
sed 's,\,,g' input.dat > output .dat
But i want to run it witb different files. So i want the input file as an input argument to the script, how could i do that.
Running it like this:
> Script.sh input.dat (2 Replies)
Discussion started by: Johanni
2 Replies
8. Shell Programming and Scripting
Hello,
I'm trying to figure out how best to approach this script, and I have very little experience, so I could use all the help I can get. :wall:
I regularly need to delete files from many directories.
A file with the same name may exist any number of times in different subdirectories.... (3 Replies)
Discussion started by: *ShadowCat*
3 Replies
9. Shell Programming and Scripting
I have four files:
test
test2
test3
test4
I have this simple script:
#!/bin/bash
ls $1
Why does ./the_script.sh test* only list the first file, when a normal ls test* would list all four? What do I need to change in the script to be able to use wildcard? (12 Replies)
Discussion started by: KidCactus
12 Replies
10. UNIX for Dummies Questions & Answers
I know I can obtain the file names in a folder by doing the following.
ls | awk '{t=$1; print t}'
Rather than print t, I'd like to take the file name as an input to a script like
bash-3.00$ more test.sh
echo "this is a test"
ls -l $1
When I run the script, I put "./test.sh a.out" and... (5 Replies)
Discussion started by: learnix
5 Replies
LEARN ABOUT CENTOS
getpassphrase
getpass(3C) Standard C Library Functions getpass(3C)
NAME
getpass, getpassphrase - read a string of characters without echo
SYNOPSIS
#include <stdlib.h>
char *getpass(const char *prompt);
char *getpassphrase(const char *prompt);
XPG4, SUS, SUSv2
#include <unistd.h>
char *getpass(const char *prompt);
DESCRIPTION
The getpass() function opens the process's controlling terminal, writes to that device the null-terminated string prompt, disables echoing,
reads a string of characters up to the next newline character or EOF, restores the terminal state and closes the terminal.
The getpassphrase() function is identical to getpass(), except that it reads and returns a string of up to 257 characters in length.
RETURN VALUES
Upon successful completion, getpass() returns a pointer to a null-terminated string of at most 9 bytes that were read from the terminal
device. If an error is encountered, the terminal state is restored and a null pointer is returned.
ERRORS
The getpass() and getpassphrase() functions may fail if:
EINTR The function was interrupted by a signal.
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 OPEN_MAX file descriptors are currently open in the calling process.
ENFILE The maximum allowable number of files is currently open in the system.
ENXIO The process does not have a controlling terminal.
USAGE
The return value points to static data whose content may be overwritten by each call.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Interface Stability |getpass() is Standard. |
+-----------------------------+-----------------------------+
|MT-Level |Unsafe |
+-----------------------------+-----------------------------+
SEE ALSO
attributes(5), standards(5)
SunOS 5.10 2 Sep 2003 getpass(3C)