Read: no query process ERROR


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Read: no query process ERROR
# 1  
Old 11-23-2016
RedHat Read: no query process ERROR

Hi,

With root user i set this in the .bashrc of user1 on machine 1

Code:
more .bashrc
./track.sh
# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi

Content of track.sh are
Code:
more track.sh
read -p "Enter ID:" reason
while [[ $reason == '' ]] # While string is different or empty...
do
    echo "Enter a valid string" # Ask the user to enter a valid string
    read -p "Enter ID: " reason # Ask the user to enter a string
done

When user1 tries to login to machine1 from machine 2 by typing

Code:
ssh user1@machine1

He enters username and password and then instead of getting the prompt
Quote:
Enter ID
he sees infinite loop like below

Quote:
Enter a valid string
./track.sh[5]: read: no query process
Enter a valid string
./track.sh[5]: read: no query process
Enter a valid string
./track.sh[5]: read: no query process
Enter a valid string
./track.sh[5]: read: no query process
Enter a valid string
.....
.....
I m on Linux OS

Can you tell me why infinite loop instead of a prompt for ID ???
# 2  
Old 11-23-2016
"no query process" is the error KSH makes when you try to read from a nonexistent co-process. -p means something way different in ksh than bash.

Don't use read -p if you don't know for a fact that the shell is bash, just do

Code:
printf "%s:  "  "prompt string" # Print a prompt without newline
read VARIABLE

You could also put #!/bin/bash as the first line to force it to run using bash.
This User Gave Thanks to Corona688 For This Post:
# 3  
Old 11-24-2016
RedHat

Your suggestion would resolve the issue, but becoz of this issue i m running into an infinite loop; doesn't even let me login to the box so; how can i remove the -p option?

Me, being the only root user ...Any solution to this ?

Last edited by mohtashims; 11-24-2016 at 11:44 PM..
# 4  
Old 11-25-2016
Do you mean that you can't log in to change it because you hit the problem too? There might be a way around it if:-
  • You have backup software that you can undo the changes with
  • You can run an ssh command from another server that doesn't try to read the files in error
  • You can scp or sftp to the server to get, correct & replace the files
Are any of these an option?

Failing that, you might need to boot in a special way with an in-memory OS and then access and update the disks from within there, but it can be fiddly. If we do go that way, I have a few questions:-
  • What OS do you have installed? (vendor & version)
  • What hardware do you have, including console?
  • Do you have install media?

We will do our best to help you.


Robin
# 5  
Old 11-25-2016
Quote:
Originally Posted by mohtashims
Me, being the only root user ...Any solution to this ?
yes, two things actually: first, use scp to overwrite/move track.sh so that it doesn't bother you any more. Then log on normally and continue.

Second and foremost: it is a long standing knowledge that anything that:

- creates output
- does any processing
- is interactive

does NOT BELONG INTO A PROFILE at all. This is true especially for a root user, which is always the ultima ratio to resort to if anything else goes wrong. Do NOT USE this user account for something you need to do daily, because - as you have just seen - whatever you do it could go wrong and then lock you out of the system.

I hope this helps.

bakunin
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Read input file and used it to SQL query

Hi All, Seeking for your assistance to read each line $1 and $2 of input file and used it to query. Ex. file1.txt(number range) 9064500000 9064599999 9064600000 9064699999 9064700000 9064799999 Database name: ranges_log a_no message 9064500001 test 9064700000 ... (7 Replies)
Discussion started by: znesotomayor
7 Replies

2. Shell Programming and Scripting

How do I read sql query into shell script?

Hello All, I'm trying to put together a shell script that will: 1. connect to an oracle database 2. execute a query 3. save the output to a csv file I know that I can execute the sqlplus -s user/pass @dbsid and get logged in. What I would like to do is have my query in a separate text... (9 Replies)
Discussion started by: bbbngowc
9 Replies

3. UNIX for Advanced & Expert Users

Using awk to read a file and process

I am fairly green using awk so I don't have anything started but what I am trying to do is: I have a file called "contacts" and in the file are 3 fields separate by ;. I want to read each line and send an email script. I have the email function working but just need to know how to setup awk to... (8 Replies)
Discussion started by: ziggy6
8 Replies

4. Shell Programming and Scripting

How to read query string from shell script?

Hi, I am new this shell scripting. I have one html page which is executing shell script. That web form is passing some query strings to the script. Now how can I read query string in shell script and parse it in variables. I tried with below shell script but its not working. #!/bin/sh ... (6 Replies)
Discussion started by: jdp
6 Replies

5. Shell Programming and Scripting

While read line query !!!

Folks, I am working on a file which has entries as follows. I am using while read line to generate desired output as follows. filename1: Name : sdt2156157_ID NOS : 4567 NOS : 2348 Name : sdt2156158_ID NOS : 4987 NOS : 2332 while read line... (3 Replies)
Discussion started by: dynamax
3 Replies

6. Shell Programming and Scripting

Read value from user and use it in Oracle SQL query

Guys can anyone just tell me whether i can pass a value(from UNIX SCRIPT) as an ARGUMENT in Oracle Query? e.g. echo "enter value" read value insert into tablename where col=$value /*something like this*/ (1 Reply)
Discussion started by: subodh.thakar
1 Replies

7. Programming

read input-process-output

Can you help me ? I want to write a program ,which can open a input file (input.txt) and run as child process ,then write to output file (output.txt)....... char inFile="input.txt"; char outFile="output.txt"; int main(int argc, char **argv) { pid_t pid=1; int no=0; // no. of... (5 Replies)
Discussion started by: cupid1575
5 Replies

8. Solaris

Query related to boot process of Solaris x86

I am a linux user and trying to relate Solaris x86 boot process with that of Linux.. Please correct me if wrong with my understanding on Solaris x86 booting process: 1.POST by BIOS. 2.BIOS loads mboot program from MBR of the hard disk. 3.mboot loads Grub stage1 from /boot/grub/stage1 4.Grub... (0 Replies)
Discussion started by: saagar
0 Replies

9. UNIX for Advanced & Expert Users

oracle process query !

This query is For HP-UX 11i server. I have certain oracle process that are running on my system as below :- rotmgr 3986 1 0 07:49:33 ? 0:00 oracleedjlive (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq))) rotmgr 26356 1 0 08:14:32 ? 0:00 oracleedjlive... (4 Replies)
Discussion started by: kpatel786
4 Replies

10. Shell Programming and Scripting

trying to read batch process but need some command help

I am trying to access batch process that take place each nite. I am using Solaris 5.8 (and i am used to redhat). however I am trying to access say a certain directory. The home/oradev , is the directory...in there i am trying to access say a batch file within this, how can see if they are in... (1 Reply)
Discussion started by: etravels
1 Replies
Login or Register to Ask a Question