10-24-2013
Quote:
Originally Posted by
wisecracker
This was just an idea...
I wasn't actually asking anything. I was experimenting with generating an error code
system of my own with values outside of an 8 bit range.
I used the real 255 exit code as 'number out of range' flag and then generate a string
whilst exit is in process. This string was originally a number, but I decided to make it
a string instead, purely for fun.
I am not sure if this will work in any way: return codes are not coming out of thin air, but the result of a system call, as jim mcNamara has explained. It can't give you back more than it ought to. It is defined as an unsigned 8-bit integer, so it can't deliver a 16- (or 32-, 64-, ...) bit number, a string or whatever. This would mean that this value has to be put on the stack and then pulled off it by the wait() or waitpid()-function. As the function would not know that it is expected to get that off the stack it won't do it and the stack would be (and stay) subsequently corrupted.
If you want to have extended exit-messages of any sort - strings, numbers, whatever - you will have to use the classical means of conveying such messages: interprocess communication (aka semaphores, shared memory segments, ... - take your pick) or process-to-process I/O, like file descriptors and/or named pipes. Write to <stdout>, <stderr>, etc. and intercept this with pipes, I/O-redirection and the like.
Another option is to write to a log file of some sort and have that parsed from the calling process.
Quote:
Originally Posted by
wisecracker
Perhaps I shouldn't have posted it...
There is no harm done in discussing anything and i am convinced this board won't go down from 1k characters of non-conclusive discussion. Still, i think you should post such topics (and the likes - you seem to enjoy exploring the limits of the OS in general and the shell in specific) not in the beginner forum. This is clearly not the stuff someone who learned the shell yesterday asks first. Please consider moving to the experts forum for topics like this.
I hope this helps.
bakunin
This User Gave Thanks to bakunin For This Post:
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I have the below script I am running on a Solaris system to check the status of a Tivoli Workload Scheduler job and return the status. We need this script to return a '0' if any of the jobs in the stream are in a "EXEC" state and an "1" if in a "HOLD" state. I am not a programmer so I am not sure... (1 Reply)
Discussion started by: leezer1204
1 Replies
2. UNIX for Dummies Questions & Answers
Suppose I have a script which is monitoring a directory
whenever a file drops in that directory,it sends alert
say I want to write a return code for the above script
which on successful execution of script gives a return value
Based on return code , I want to do initiate some jobs in other... (1 Reply)
Discussion started by: abhib45
1 Replies
3. UNIX for Dummies Questions & Answers
Hi,
Can anyone tell me if there are return codes for SFTP? If so how would you capture them? I've tried 'man sftp' but its not particularly helpful.
Many thanks
Helen :confused: (4 Replies)
Discussion started by: Bab00shka
4 Replies
4. UNIX for Advanced & Expert Users
I have a simple script which renames a file.How do i capture the return code of the script if the script fails (3 Replies)
Discussion started by: kris01752
3 Replies
5. HP-UX
Can any body please tell me the return codes of RDIST tool?
I am using RDIST (through an UNIX script) to synchronize files between two servers say ukblx151(source) & ukapx050(target).
RDIST raises an alert mail (through notify option) in case of success & also failure but there is a problem if... (0 Replies)
Discussion started by: vishal_ranjan
0 Replies
6. Shell Programming and Scripting
Hi
In an unix script I am using an Perl one liner perl -i -ne '-----'
If the perl one liner fails i am not able to catch the return code.
It always give 0 as return code. Can you tell me how can i catch the return code
perl -i -ne '---'
RETCODE=$?
echo $RETCODE
Thanks and Regards
Ammu (2 Replies)
Discussion started by: ammu
2 Replies
7. UNIX for Dummies Questions & Answers
This is a high-level explanation, if more details are needed, please do not hesitate to ask.
I have a set of .ctl files which I want to execute:
AV1.ctl
AV2.ctl
AV3.ctl
I have a script which has a for loop in it:
for filename in AV1 AV2 AV3
do
. execute_another_script.sh
done
... (2 Replies)
Discussion started by: hern14
2 Replies
8. Shell Programming and Scripting
sftp -v b $putlist $SFTP_ID@TARGET_SERVER
How can I get a return code if fails to put the file?
sftp -v b $getlist $SFTP_ID@TARGET_SERVER
How can I get a return code if fails to put the file? (1 Reply)
Discussion started by: TimHortons
1 Replies
9. Shell Programming and Scripting
Hi,
I wanted to know the significance of different return codes when we do echo $?
I know when $? returns 0 the command has worked successfully.
but what does $? = 1, 2, 3 etc. signify.
Thanks in advance for the help !!! (3 Replies)
Discussion started by: aarti.popi
3 Replies
10. UNIX and Linux Applications
Having searched high and low through Oracles documentation, I came to think that they're very scripting-averse, as there's (apparently) no list of possible return/exit codes for their various command line utilities.
Is anyone here in possession of such a list, or knows where to find one? It... (16 Replies)
Discussion started by: pludi
16 Replies
LEARN ABOUT MOJAVE
locale::codes::langvar
Locale::Codes::LangVar(3pm) Perl Programmers Reference Guide Locale::Codes::LangVar(3pm)
NAME
Locale::Codes::LangVar - standard codes for language variation identification
SYNOPSIS
use Locale::Codes::LangVar;
$lvar = code2langvar('acm'); # $lvar gets 'Mesopotamian Arabic'
$code = langvar2code('Mesopotamian Arabic'); # $code gets 'acm'
@codes = all_langvar_codes();
@names = all_langvar_names();
DESCRIPTION
The "Locale::Codes::LangVar" module provides access to standard codes used for identifying language variations, such as those as defined in
the IANA language registry.
Most of the routines take an optional additional argument which specifies the code set to use. If not specified, the default IANA language
registry codes will be used.
SUPPORTED CODE SETS
There are several different code sets you can use for identifying language variations. A code set may be specified using either a name, or
a constant that is automatically exported by this module.
For example, the two are equivalent:
$lvar = code2langvar('en','alpha-2');
$lvar = code2langvar('en',LOCALE_CODE_ALPHA_2);
The codesets currently supported are:
alpha
This is the set of alphanumeric codes from the IANA language registry, such as 'arevela' for Eastern Armenian.
This code set is identified with the symbol "LOCALE_LANGVAR_ALPHA".
This is the default code set.
ROUTINES
code2langvar ( CODE [,CODESET] )
langvar2code ( NAME [,CODESET] )
langvar_code2code ( CODE ,CODESET ,CODESET2 )
all_langvar_codes ( [CODESET] )
all_langvar_names ( [CODESET] )
Locale::Codes::LangVar::rename_langvar ( CODE ,NEW_NAME [,CODESET] )
Locale::Codes::LangVar::add_langvar ( CODE ,NAME [,CODESET] )
Locale::Codes::LangVar::delete_langvar ( CODE [,CODESET] )
Locale::Codes::LangVar::add_langvar_alias ( NAME ,NEW_NAME )
Locale::Codes::LangVar::delete_langvar_alias ( NAME )
Locale::Codes::LangVar::rename_langvar_code ( CODE ,NEW_CODE [,CODESET] )
Locale::Codes::LangVar::add_langvar_code_alias ( CODE ,NEW_CODE [,CODESET] )
Locale::Codes::LangVar::delete_langvar_code_alias ( CODE [,CODESET] )
These routines are all documented in the Locale::Codes::API man page.
SEE ALSO
Locale::Codes
The Locale-Codes distribution.
Locale::Codes::API
The list of functions supported by this module.
http://www.iana.org/assignments/language-subtag-registry
The IANA language subtag registry.
AUTHOR
See Locale::Codes for full author history.
Currently maintained by Sullivan Beck (sbeck@cpan.org).
COPYRIGHT
Copyright (c) 2011-2013 Sullivan Beck
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl v5.18.2 2014-01-06 Locale::Codes::LangVar(3pm)