Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Script input from File using < Post 303045683 by busyboy on Wednesday 8th of April 2020 11:09:19 AM
Old 04-08-2020
my apologies

Its a Centos-7 Box with both BASH and SH available.

I want to display the inputs as well when the input is coming from a file ( only when the input is coming from file not in interactive mode of execution of script)

Code:
#./makeit.sh <answers
Please enter Your First Name: NAME
Please enter Your Last Name:  LNAME
Please enter your Address:   PASRUR
Please enter your phone number: 23456
NAME, LNAME
PASRUR, 23456

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

file as input for script

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

Script for reading an input file

#!/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

input from a file into an expect script ?

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

Parshing script using input from a file to another

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

Need script to take input from file, match on it in file 2 and input data

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

AWK Script to convert input file(s) to output file

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

Input file to bash script

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

Script to delete files with an input for directories and an input for path/file

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

Wildcards in file input to a script?

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

Use file name as an input to a script

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
RNEWS(1)						      General Commands Manual							  RNEWS(1)

NAME
rnews - receive news from a UUCP connection SYNOPSIS
rnews [ -h host ] [ -v ] [ -U ] [ -N ] [ -S master ] [ input ] DESCRIPTION
Rnews reads messages typically queued by a UUCP newsfeed and sends them to the local InterNetNews server. The message is read from the specified input file, or standard input if no input is named. When sent over UUCP, Usenet articles are typically joined in a single batch to reduce the UUCP overhead. Batches can also be compressed, to reduce the communication time. If a message does not start with a number sign (``#'') and an exclamation point, then the entire input is taken as a single news article. If it does start with with those two characters, then the first line is read and interpreted as a batch command. If the command is ``#! rnews nnn'' where nnn is a number, then the next nnn bytes (starting with the next line) are read as a news article. If the command is ``#! cunbatch'' then the rest of input is fed to the compress(1) program with the ``-d'' flag to uncompress it, and the output of this pipe is read as rnews's input. This is for historical compatibility -- there is no program named cunbatch. A compressed batch will start with a ``#! cunbatch'' line, then contain a series of articles separated by ``#! rnews nnn'' lines. If the command is any other word, then rnews will try to execute a program with that name in the directory /usr/lib/news/rnews. The batch will be fed into the program's standard input, and the standard output will be read back as input into rnews. If rnews detects any problems with an article such as a missing header, or an unintelligible reply from the server, it will save a copy of the article in the /var/spool/news/in.coming/bad directory. OPTIONS
-S If the ``-S'' flag is used, then rnews will connect to the specified host. If the flag is not used, it will try to connect to the server by opening a Unix-domain stream connection. If that fails, it will try to open a TCP connection to the default remote server. -U If the server is not available, the message is spooled into a new file created in the /var/spool/news/in.coming directory. The ``-U'' flag may be used to send all spooled messages to the server once it becomes available again, and can be invoked regularly by cron(8). -N Normally, if unpacking the input fails it is re-spooled to /var/spool/news/in.coming for another attempt later. If the ``-N'' flag is used then no such re-spooling is done and rnews exits with status value ``9'' to indicate this. -v If the ``-v'' flag is used, it will print a notice of all errors on the standard error, naming the input file (if known) and print- ing the first few characters of the input. Errors are always logged through syslog(3). -h If the ``-h'' flag is given, or failing that, the enviroment variable UU_MACHINE is set, then rnews will log the Message-ID, and host, for each article offered to the server via syslog(3). Logging will only be done if the value is not an empty string. BUGS
Rnews cannot process articles that have embedded 's in them. HISTORY
Written by Rich $alz <rsalz@uunet.uu.net> for InterNetNews. This is revision 1.23, dated 1996/11/08. SEE ALSO
innd(8). RNEWS(1)
All times are GMT -4. The time now is 09:33 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy