Sponsored Content
Top Forums Shell Programming and Scripting return code of a unix command Post 302129969 by jim mcnamara on Thursday 2nd of August 2007 03:34:38 PM
Old 08-02-2007
Note: rm * can be very dangerous, be careful

Code:
<some command>
echo "$?"

will display 0 if "some command" was successful. It will show 1 (or another non-zero number) if the command failed. Usually commands also display error messages when something goes wrong.
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Move command return with exit code of 2

I have a script which loads data files into Oracle and then moves each file into a 'processed' directory when each file has finished loading. Last night I found that the script was failing on the mv statement (with a return code 2) and the following message, mv: cannot access... (1 Reply)
Discussion started by: handak9
1 Replies

2. UNIX for Dummies Questions & Answers

to pick up the Return Code ( RC) from the mailx command and return it to SAS uisng 's

Hi All, Can anyone please let me know the syntax / how to pick up the Return Code ( RC) from the mailx command and return it to SAS uisng 'system()' function and '${?}'. I am in a process to send the mail automatically with an attachment to bulk users. I have used 'Mailx' and 'Unencode'... (0 Replies)
Discussion started by: manas6
0 Replies

3. Shell Programming and Scripting

Return code of command assigned to variable

How do I evaluate the result of a command assigned to a variable?? Example: var1=`cmd` rc=$? rc will be the result of the assignment rather than cmd since it executes after. How do I evaluate the result of the command itself? Cheers..:confused: (2 Replies)
Discussion started by: browndr
2 Replies

4. HP-UX

return code from oracle to unix script

Hi I'm writing a shell script that connects to oracle database and fires query to check the availability of data in a table. In case of no data found then what will be the return code and how to handle in that in variable. Kindly provide with an example for better understanding... Thanks... (1 Reply)
Discussion started by: ksailesh
1 Replies

5. Shell Programming and Scripting

How to get the return code of subroutines executed as standalone as command line in Perl ?

How to do I get the return code of a subroutine in a perl module if invoke the subroutine as standalone, I have an module say TestExit.pm and in that i have a subroutine say myTest() which is returns 12, if i were to call the subroutine from command line like CASE:1 ( Without an explict... (2 Replies)
Discussion started by: ennstate
2 Replies

6. Shell Programming and Scripting

Writing a UNIX script from LOG to provide return code.

Folks - Firstly, I do apologize that my first post here is a question. I am quite familiar with UNIX since our application is running on it. We are trying to automate a few things on our end and I am challenged with a task in hand that requires UNIX scripting. I am totally a newbie in UNIX... (4 Replies)
Discussion started by: sk72
4 Replies

7. Shell Programming and Scripting

Managing awk return code over SSH command

Hello all, This bellow code works. I'm just trying to find a simplified way to achieve this. I'm sure there is an easier way and it must be to simple for me to find. Verify that the OS version is 6.1. If not exit the script. Of course if i just put a && exit 1 at the end of the ssh... (11 Replies)
Discussion started by: maverick72
11 Replies

8. Shell Programming and Scripting

Unix return code example

Hi, Does anyone here can guide me to understand how is return code works in a parent-child relation with a simple example? I have a request to build the script with return code in a child script, but i want to understand how does child script can return a code to the parent, stated if its... (4 Replies)
Discussion started by: khchong
4 Replies

9. Shell Programming and Scripting

save the return value of a unix command

Hi all, I am new in linux script, and I have the code below #!/bin/bash CMD="shuf -i 1-5 -n 1" $CMD echo $CMD exit 0 if I run the $CMD, it will return me a shuffle value. However, I need to save the return value of the shuffle, and use it later on. I tried for example print the... (3 Replies)
Discussion started by: peuceul
3 Replies

10. Shell Programming and Scripting

How to exit a shell script if a unix command does not return any value for 10 seconds?

Hi, Can anyone help me how to exit a shell script if a unix command inside does not return any value for 10 seconds? The scenarios is like this. I want to login to a application using shell script where the connection string is mentioned.but suppose this connection string is not... (10 Replies)
Discussion started by: arijitsaha
10 Replies
chatwidget(3tk) 				      Composite widget for chat applications					   chatwidget(3tk)

__________________________________________________________________________________________________________________________________________________

NAME
chatwidget - Provides a multi-paned view suitable for display of chat room or irc channel information SYNOPSIS
package require Tk 8.5 package require chatwidget ?1.0.0? ::chatwidget::chatwidget path ?options? $widget topic command args $widget name nick args $widget message text args $widget hook command args $widget names args $widget entry args $widget chat args _________________________________________________________________ DESCRIPTION
This is a composite widget designed to simplify the construction of chat applications. The widget contains display areas for chat messages, user names and topic and an entry area. It automatically handles colourization of messages per nick and manages nick completion. A system of hooks permit the application author to adjust display features. The main chat display area may be split for use displaying history or for searching. The widget is made up of a number of text widget and panedwindow widgets so that the size of each part of the display may be adjusted by the user. All the text widgets may be accessed via widget passthrough commands if fine adjustment is required. The topic and names sections can also be hidden if desired. COMMANDS
::chatwidget::chatwidget path ?options? Create a new chatwidget using the Tk window id path. Any options provided are currently passed directly to the main chat text wid- get. WIDGET COMMANDS
$widget topic command args The chat widget can display a topic string, for instance the topic or name given to a multi-user chatroom or irc channel. show Enable display of the topic. hide Disable display of the topic set topic Set the topic text to topic. $widget name nick args Control the names and tags associated with names. list ?-full? Returns a list of all the user names from the names view. If -full is given then the list returned is a list of lists where each sublist is made up of the nick followed by any options that have been set on this nick entry. This may be used to exam- ine any application specific options that may be applied to a nick when using the add command. add nick ?options? delete nick $widget message text args Add messages to the display. options are -nick, -time, -type, -mark -tags $widget hook command args Manage hooks. add (message, post names_group, names_nick, chatstate), remove, run $widget names args Passthrough to the name display text widget. See the text widget manual for all available commands. The chatwidget provides two additional commands show and hide which are used to control the display of this element in the widget. $widget entry args Passthrough to the entry text widget. See the text widget manual for all available commands. $widget chat args Passthrough to the chat text widget. See the text widget manual for all available commands. EXAMPLE
chatwidget::chatwidget .chat proc speak {w msg} {$w message $msg -nick user} .chat hook add post [list speak .chat] pack .chat -side top -fill both -expand 1 .chat topic show .chat topic set "Chat widget demo" .chat name add "admin" -group admin .chat name add "user" -group users -color tomato .chat message "Chatwidget ready" -type system .chat message "Hello, user" -nick admin .chat message "Hello, admin" -nick user A more extensive example is available by examining the code for the picoirc program in the tclapps repository which ties the tcllib picoirc package to this chatwidget package to create a simple irc client. SEE ALSO
text(3tk) KEYWORDS
chat, chatwidget, composite widget, irc, mega-widget, widget chatwidget 1.0.0 chatwidget(3tk)
All times are GMT -4. The time now is 06:43 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy