Sponsored Content
Top Forums UNIX for Dummies Questions & Answers How to know the status of a Command? Post 302386591 by thegeek on Tuesday 12th of January 2010 10:13:42 PM
Old 01-12-2010
A slight variation.

Code:
$ cp file1 file2
$ echo $?

Ref: Exit and Exit Status

Code:
Every command return exit status (sometimes referred to as a return status or exit code). A successful command returns a 0, while an unsuccessful one returns a non-zero value that usually can be interpreted as an error code. Well-behaved UNIX commands

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Status of the second to last command

Below is a chuck of a shell script I have written. The problem I am having is with the test section. I want to test the status of the f60gen command but since I'm running the output of the f60gen command into tee, the test command is actually testing "tee" and not "f60gen". Is there a way to... (5 Replies)
Discussion started by: goswell
5 Replies

2. Shell Programming and Scripting

Status code of last command execution

Hello people, I am using KSH and inside my script I do a cksum and check the status code to see whether the command sucessfully. Here even though the cksum fails due to file not existing the status returned is still 0 because the awk command worked fine. How do I capture just the status of the... (1 Reply)
Discussion started by: tipsy
1 Replies

3. Shell Programming and Scripting

Getting the exit status of a remote command

Hi to everyone. How can I get the exit status from a remote command executed with rexec? :eek: machine A has RedHat Linux 9 and the remote machine B has SCO UNIX. Code: rexec -l user -p password host sh /u/files/scripts/seq_cal.sh 2006 08 I want the exit status returned by... (1 Reply)
Discussion started by: zoonalex
1 Replies

4. AIX

Tape status command

We sometime run backups to tape in the background using the cron. Is there a command that will show me how fast the information is being written and or how much data has been written? I know if we enter the information via the command prompt or smit it shows the speed and amount written. (2 Replies)
Discussion started by: daveisme
2 Replies

5. Shell Programming and Scripting

returning status of a command

Hello gurus, Tired of using $? to view the execution status of the previous command. how can I get the status directly? definitely this is not working, if ] then fi (6 Replies)
Discussion started by: biglau
6 Replies

6. Shell Programming and Scripting

last command status problem

Hi there is below code in my code , i did not understand what does it mean RC=0 RC=$(( RC | $? )) Please help me regarding this ---------- Post updated at 02:22 AM ---------- Previous update was at 01:46 AM ---------- Below is more example of the code (2 Replies)
Discussion started by: aishsimplesweet
2 Replies

7. UNIX for Advanced & Expert Users

Equivalents of tee command to find exit status of command

Hi, Want to log the output of command & check the exit status to find whether it succeeded or failed. > ls abc ls: abc: No such file or directory > echo $? 1 > ls abc 2>&1 | tee log ls: abc: No such file or directory > echo $? 0 Tee commands changes my exit status to be always... (7 Replies)
Discussion started by: vibhor_agarwali
7 Replies

8. UNIX for Dummies Questions & Answers

Check the exist status of the cd command

Hi, As in scripting , some cd commands getting failed, so we do check the exist status as 0 or 1. But every time we call to function for it. But does any single line exist will do the job with || , && ? i.e ls -l Logs cd Logss | exit echo hias Logss is not exist , Before printing "hi" we... (5 Replies)
Discussion started by: posix
5 Replies

9. UNIX for Dummies Questions & Answers

Exit Status Of Find Command

Hello All, I am trying to capture the exit status of find command and want to delete the files only when it is successful. But it is always returning me as success even if the pattern of that file doesn't exist in the current directory. please help, checked manual page but couldn't able to figure... (6 Replies)
Discussion started by: Ariean
6 Replies

10. Shell Programming and Scripting

Exit Status of Command

Hi All, I am doing an export and import (datapump) of 4 schema. I know we can do an export of 4 schema in one command. But just want to know how to check the exit status if i do the export/import of 4 schema in different commands in background. Please suggest. Thanks, Mani (1 Reply)
Discussion started by: pvmanikandan
1 Replies
BOS_HELP(8)						       AFS Command Reference						       BOS_HELP(8)

NAME
       bos_help - Displays help for bos commands

SYNOPSIS
       bos help [-topic <help string>+] [-help]

       bos h [-t <help string>+] [-h]

DESCRIPTION
       The bos help command displays the complete online help entry (short description and syntax statement) for each command operation code
       specified by the -topic argument. If the -topic argument is omitted, the output includes the first line (name and short description) of the
       online help entry for every bos command.

       To list every bos command whose name or short description includes a specified keyword, use the bos apropos command.

OPTIONS
       -topic <help string>+
	   Indicates each command for which to display the complete online help entry. Omit the bos part of the command name, providing only the
	   operation code (for example, specify status, not bos status). If this argument is omitted, the output briefly describes every bos
	   command.

       -help
	   Prints the online help for this command. All other valid options are ignored.

OUTPUT
       The online help entry for each bos command consists of the following two or three lines:

       o   The first line names the command and briefly describes its function.

       o   The second line lists aliases for the command, if any.

       o   The final line, which begins with the string "Usage", lists the command's options in the prescribed order. Online help entries use the
	   same symbols (for example, brackets) as the reference pages in this document.

EXAMPLES
       The following command displays the online help entry for the bos status command:

	  % bos help status
	  bos status: show server instance status
	  Usage: bos status -server <machine name> [-instance <server
	  process name>+] [-long] [-cell <cell name>] [-noauth]
	  [-localauth] [-help]

PRIVILEGE REQUIRED
       None

SEE ALSO
       bos(8), bos_apropos(8)

COPYRIGHT
       IBM Corporation 2000. <http://www.ibm.com/> All Rights Reserved.

       This documentation is covered by the IBM Public License Version 1.0.  It was converted from HTML to POD by software written by Chas
       Williams and Russ Allbery, based on work by Alf Wachsmann and Elizabeth Cassell.

OpenAFS 							    2012-03-26							       BOS_HELP(8)
All times are GMT -4. The time now is 07:06 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy