Sponsored Content
Top Forums Shell Programming and Scripting how to exit status of a piped process ??? Post 302554221 by ashwini.engr07 on Saturday 10th of September 2011 10:29:56 PM
Old 09-10-2011
Thanks binlib. Yes I'm aware of the PIPESTATUS array. But it works only with piped foreground processes and not background ones.

I want the processes to run in background because I want them to be interrupted when a user presses ctrl+c... if it runs in foreground, it'll get the higher priority and won't stop until it finishes even though user has interrupted it.

This is the reason for wanting it to run in background.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

exit status

i downloaded a text file from metalab.unc.edu called sh.txt and in this reference manual it refers to shell scripting exit status .. at the end of one of the examples that author gave an exit status of 127.. to what does a 127 exit status refer too and what is its purpose in the code. moxxx68 (1 Reply)
Discussion started by: moxxx68
1 Replies

2. Shell Programming and Scripting

exit status for isql

I'm trying to write a script that will update a table in sysbase. If it's failed then I want to rerun it one more time before exiting the script (fail due to bad value such as trying to put a string into datetime field or bad connection to the database) Well my code below will always return... (2 Replies)
Discussion started by: sirrtuan
2 Replies

3. Shell Programming and Scripting

How to get the exit status

Hi all, I'm running a program which return 1 upon success. But when encounters problem shell return 's '1' . How to differentiate between them the shell return value and script return value. Ex. function fn return '1' if executed successfully and '0' if failed. But when if shell encounters... (1 Reply)
Discussion started by: yhacks
1 Replies

4. Shell Programming and Scripting

Exit status

I'm preparing for exam and one of exams is to write own test command... I wonder if in unix is a command which just returns exit code you specify.. I know I can easily write a function like this: exStatus() { return $1 } -> my question is rather theoretical thank you! (9 Replies)
Discussion started by: MartyIX
9 Replies

5. Shell Programming and Scripting

Exit status of grep

I am trying to get the exit status of grep and test a condition with it, But it does not seem to be working as expected since i am doing something wrong apparently as per grep help Exit status is 0 if match, 1 if no match, and 2 if trouble. My problem is something like this templine - a... (7 Replies)
Discussion started by: prasbala
7 Replies

6. Shell Programming and Scripting

Exit status redirection

Hi, I'm having this simple code below, the file serverlist has a list of IPs one per line. When executed the while loop is executed only once, after that the program terminates. How should i redirect the exit status, so that the entire list of IP will get executed? #!/bin/bash exec <... (4 Replies)
Discussion started by: agent001
4 Replies

7. Shell Programming and Scripting

Unable to find exit status of piped command

Lois_Answer_Code=`sipsak -vv -s sip:192.168.1.3|grep -A 1 "reply received after"|grep SIP|awk '{print $2}'`How to find the exit status of | (12 Replies)
Discussion started by: proactiveaditya
12 Replies

8. Shell Programming and Scripting

Exit Status

I have a shell script (#!/bin/sh) that interacts with Appworx and Banner Admin. In my script I want to check the exit status of awrun before continuing. awrun can run for 10 seconds or it can run for over a minute. So my question is, will it go through my if statement before awrun may even be... (2 Replies)
Discussion started by: smkremer
2 Replies

9. Shell Programming and Scripting

SSH Process monitoring and Exit Status evaluation

Hi All, I have a peculiar requirement as follows, I have a some hosts on which i have to run a script, so i am using the following code piece for i in $HOSTLIST do ssh ${i} "~/task.sh" done Now i want to run this same thing in parallel on all the hosts and then monitor the ssh process... (1 Reply)
Discussion started by: mihirvora16
1 Replies

10. Shell Programming and Scripting

Want to get the exit status

Hi All, I am trying to create a zip file with all the txt files(these are in large number) in the current directory. I am able to do this operation sucessfully. After this i want to get the status of the tar command executed and do accordingly. When i am trying with the below code, the status... (3 Replies)
Discussion started by: paddu
3 Replies
nice(1) 						      General Commands Manual							   nice(1)

NAME
nice - Runs a command at a different priority SYNOPSIS
Current syntax nice [-n priority] command [argument...] Obsolescent syntax nice [-priority] command [argument...] Note The C shell has a built-in version of the nice command. If you are using the C shell, and want to guarantee that you are using the command described here, you must specify the full path /usr/bin/nice. See the csh(1) reference page for a description of the built-in command. STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: nice: XCU5.0 Refer to the standards(5) reference page for more information about industry standards and associated tags. OPTIONS
Specifies how the system scheduling priority of the executed utility is adjusted. The priority argument is a positive or negative decimal integer. Positive priority values cause a lower or unchanged system scheduling priority. Negative priority values might require appropriate privileges and cause a higher or unchanged system scheduling priority. Specifies how the system scheduling priority of the executed utility is adjusted. (Obsolescent) OPERANDS
The name of a utility that is to be invoked. Any string to be supplied as an argument to the utility named by the command operand. DESCRIPTION
The nice command lets you run the specified command at a lower priority. The value of priority can range from 1 to 19, with 19 being the lowest priority. The default value of priority is 10. [Tru64 UNIX] If you have superuser authority, you can run commands at a higher priority by specifying priority as a negative number; for example, -10. NOTES
The csh command contains a built-in subcommand named nice. The command and subcommand do not necessarily work the same way. For informa- tion on the subcommand, see the csh command. EXIT STATUS
The nice command returns the following exit values: An error occurred in the nice utility. The specified command was found but could not be invoked. The specified command could not be found. EXAMPLES
To run a low priority command in the background, enter: nice cc -c *.c & This runs the command cc -c *.c at low priority in the background. Your terminal is free so that you can run other commands while cc is running. See the sh command for details about starting background processes with an & (ampersand). To specify a very low prior- ity, enter: nice -n 15 cc -c *.c & This runs cc in the background at a priority that is even lower than the default priority set by nice. To specify a very high pri- ority (ksh and sh only), enter: nice -n -10 wall <<end System shutdown in 2 minutes! end This runs wall at a higher priority than all user processes. Doing this slows down everything else running on the system. If you do not have superuser authority when you run this command, then the wall command runs at the normal priority. The <<end and end arguments define a Here Document, which uses the text entered before the end line as standard input for the com- mand. For more details, see the Inline Input (Here) Documents section on the sh(1) reference page. ENVIRONMENT VARIABLES
The following environment variables affect the execution of nice: Provides a default value for the internationalization variables that are unset or null. If LANG is unset or null, the corresponding value from the default locale is used. If any of the internationalization vari- ables contain an invalid setting, the utility behaves as if none of the variables had been defined. If set to a non-empty string value, overrides the values of all the other internationalization variables. Determines the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as opposed to multibyte characters in arguments). Determines the locale for the for- mat and contents of diagnostic messages written to standard error. Determines the location of message catalogues for the processing of LC_MESSAGES. Determines the search path used to locate the command invoked. SEE ALSO
Commands: csh(1), nohup(1), renice(8) Functions: nice(3), setpriority(2) Standards: standards(5) nice(1)
All times are GMT -4. The time now is 10:44 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy