Sponsored Content
Top Forums Shell Programming and Scripting Error to Read Input from command line Post 302907697 by rocking77 on Tuesday 1st of July 2014 07:15:11 AM
Old 07-01-2014
Error to Read Input from command line

Team ,
I am trying to write a case condition for database backups.But I am unable to make the script to read input from command line .
Code:
 
 
while true ;do
 read -p "Do You Wish To Take Database Backup ?? " yn
  case $yn in
 [Yy]*) echo " YES take backup ";;
        [Nn]*) echo " NO BACKUP " ;;
         *) echo "Please Answer Yes OR NO " ;;
esac
done

I am getting below error after executing .


Code:
 
read: 0403-039 No query process for pipe.

Why this error pop up ?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

read a file as input and pass each line to another script

Hi, I am trying to write a ftp script which will read a file for filenames and ftp those files to another server. Here's my ftp script, but it's scanning the current directory for file names. My question is how can I pass multiple files (these files will have the name of data files that need to... (0 Replies)
Discussion started by: sajjad02
0 Replies

2. Shell Programming and Scripting

How can I send the input of a read line command through a shell script

Hi All, I wish to automate the unix command 'su' through a shell script. I would like to pass the content of a file as password to 'su' command. My script is as below, #! /bin/sh su userA while read line do rpm -ivh $line done < pwd.txt where pwd.txt contains the password of... (6 Replies)
Discussion started by: little_wonder
6 Replies

3. UNIX for Dummies Questions & Answers

How to read a line of text from user input?

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

4. Shell Programming and Scripting

sed to read line by line and input into another file

I have two files. Fileone contains text string one text string two text string three Filetwo contains Name: Address: Summary: Name: Address: Summary: Name: Address: Summary: I would like to use sed to read each line of file one and put it at the end of the summary line of file... (3 Replies)
Discussion started by: dolacap
3 Replies

5. Shell Programming and Scripting

filtering input from read command

I need help understanding a script I'm modifying which someone else has written. Basically I’m looping through a buffer that holds records fetched from a database query. I need a way to separate the primary key values from other attributes in the result. Heres the code: BUFF=buffer_file >... (5 Replies)
Discussion started by: d3mon_spawn
5 Replies

6. Shell Programming and Scripting

Read input while executing the command

Hi everyone, i have made a very simple script where it reads the user input and converts the number from celcius to faranheit but instead of running the command and prompting the user for input I want to be able to simply enter a number at the end of the command to run the script. ex. instead of... (1 Reply)
Discussion started by: subway69
1 Replies

7. Shell Programming and Scripting

Print output and read input on same line

How do I print output and read input on the same line in ksh? echo Hello, what is your name? read name (1 Reply)
Discussion started by: robin_simple
1 Replies

8. Shell Programming and Scripting

Read input file with in awk script not through command line

Hi All, Do we know how to read input file within awk script and send output toanother log file. All this needs to be in awk script, not in command line. I am running this awk through crontab. Cat my.awk #!/bin/awk -f function test(var){ some code} { } END { print"test code" } (5 Replies)
Discussion started by: random_thoughts
5 Replies

9. Shell Programming and Scripting

Script to read command line input and change it to some form

Hi, I want to write a small code in which script changes command line input to some form. Example script.sh a1 a2 a3 a4 ..... output should be "a1|a2|a3|....." Number of inputs in command line can be any variable (2 Replies)
Discussion started by: Raza Ali
2 Replies

10. UNIX for Dummies Questions & Answers

Input for read command

Hello, I want to use the read command in order to input a keyword from the keyboard. I then want to use this keyword in a grep command. How to I input a phrase as a keyword? For example if I use read keyword "today is" and then use grep, I get "No such file or directory" error. (6 Replies)
Discussion started by: FelipeAd
6 Replies
line(1) 						      General Commands Manual							   line(1)

NAME
line - Reads one line from standard input SYNOPSIS
line STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: line: XCU5.0 Refer to the standards(5) reference page for more information about industry standards and associated tags. OPTIONS
None DESCRIPTION
The line command copies one line, up to and including a newline, from standard input and writes it to standard output. Use this command within a shell command file to read from your terminal. The line command always writes at least a newline character. NOTES
The line utility has no internationalization features and is marked LEGACY in XCU Issue 5. Use the read utility instead. EXIT STATUS
Success. End-of-File. EXAMPLES
To read a line from the keyboard and append it to a file, enter: echo 'Enter comments for the log:' echo ': c' line >>log This shell procedure displays the message: Enter comments for the log: It then reads a line of text from the keyboard and adds it to the end of the file log. The echo ': c' command displays a : (colon) prompt. See the echo command for information about the c escape sequence. SEE ALSO
Commands: echo(1), ksh(1), read(1), Bourne shell sh(1b), POSIX shell sh(1p) Functions: read(2) Standards: standards(5) line(1)
All times are GMT -4. The time now is 07:53 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy