Sponsored Content
Top Forums Shell Programming and Scripting Passing error message back to script Post 302662737 by cero on Wednesday 27th of June 2012 05:05:07 AM
Old 06-27-2012
Simply source the called script, then all variables set there are available in the calling script too.
Code:
$ ./script1.sh
calling script 2
String: it works
Value: 1

$ cat script1.sh
echo calling script 2
. ./script2.sh
RET_VAL=$?
echo String: $RET_STRING
echo Value: $RET_VAL

$ cat script2.sh
RET_STRING="it works"
return 1
$

This User Gave Thanks to cero For This Post:
 

10 More Discussions You Might Find Interesting

1. Programming

how to passing message along pipes??

Dear All, Would you tell me how I can passing a message along pipes? I have built a token ring connected with pipes, but I don't know how to pass the message along it through the command line... Thx. Yours, i- (1 Reply)
Discussion started by: iminus
1 Replies

2. Programming

Passing Parameters and getting values back from a c program to Shell script

I am having a shell script which has to be called from a C program. I have to pass two parameters to this script. HOw can I do that? eg: int main() { char st1; char str2; // call a shell script call_sh(str1,str2) where call_sh is the name of the shell script. then i need to get the return... (5 Replies)
Discussion started by: Rajeshsu
5 Replies

3. Shell Programming and Scripting

passing oracle parameters back to Shell

Hi All, Does anyone have any solutions for passing back multiple variables back to the SHELL from a call to an ORACLE procedure: eg #username='scott' #password='tiger' #database='orcl' username='ITGCD03D03' password='tC5epIew' database='ITGCD03D' sqlplus -s... (4 Replies)
Discussion started by: satnamx
4 Replies

4. Linux Benchmarks

What are the benchmark programs for Message passing?

Is there any benchmark programs for Message Passing like SPLASH-2 for Shared Memory. (0 Replies)
Discussion started by: gkreddy
0 Replies

5. UNIX for Advanced & Expert Users

Message passing to kerenel

i want to add a system call(successfuly added) and pass the message(which contains int and a string) /*code i used my program calling system call printmsg*/ message mm; mm.m1_i1=10; mm.m1_p1="hello"; printmsg(&mm); /*user library*/ printmsg(*m1) { printf("integer... (1 Reply)
Discussion started by: kathir_dz
1 Replies

6. Shell Programming and Scripting

Passing a variable from a child script back to the parent

Hi I have written a script using ftp to get files from one server and copy them to 2 dirrerent servers. I wish to call this script from a parent script that will check the number of files copied and run a check sum for each file. As the filenames for the files in the get portion of the script... (3 Replies)
Discussion started by: Andy82
3 Replies

7. Shell Programming and Scripting

Passing variable to Expression in back ticks.

Hi, In my perl script I want to check whether *.csv files exist and take the count . Below is the code: $path = “/home/usr/jan/myfiles” my $File_Count = `ls *.csv | wc -l `; # Checks in the current directory #Works fine if files exists. my $File_Count = `ls $path/*.csv | wc -l `; # I need... (2 Replies)
Discussion started by: jisha
2 Replies

8. Solaris

Message passing toolkit

Hello, Has somebody download it before oracle deleted from support section? I tried dl it from: oracle.com/us/products/tools/message-passing-toolkit-070499.html Oracle Message Passing Toolkit but: section decommissioned. Same in support and edelivery I phoned to oracle support and... (2 Replies)
Discussion started by: time0ut
2 Replies

9. Solaris

Mail loops back to me error in /var/adm/message after patching

Hi, I am getting the below messsage in /var/adm/message after patching but sendmail is working after restoring the backup file. sendmail: q4G7U1Cj014774: SYSERR(root): 127.0.0.1 config error: mail loops back to me (MX problem?) sendmail: q4G801cw025824: SYSERR(root): 127.0.0.1 config... (3 Replies)
Discussion started by: fayaz
3 Replies

10. Shell Programming and Scripting

Passing control back to the shell script

Hi All, I have a shell script(test_abc.sh) with the following shell commands, which are invoking the same shell script with different parameters. test_abc.sh . ./test.sh abc >> test.log . ./test.sh xyz >> test.log . ./test.sh pys >> test.log . ./test.sh abc >> test.log . . ... (4 Replies)
Discussion started by: dev.devil.1983
4 Replies
script(1)						      General Commands Manual							 script(1)

NAME
script - Makes a transcript of terminal session SYNOPSIS
script [-a] [file] The script command makes a transcript of everything printed on your terminal. OPTIONS
Appends the transcript to file rather than writing it to file. OPERANDS
The name of an output file that will contain the transcript of the session. If this parameter is omitted, the file typescript is written. DESCRIPTION
The transcript is written to file, or appended to file if the -a option is given. If no file name is given, the transcript is saved in the file typescript. The script ends when the forked shell exits. This program is useful when you are using a CRT and want a hard-copy record of the dialog (for example, a technical writer might create an example of a working session this way). If you specify the -a option and the file does not exist, it is created. If you do not specify the -a option and the file exists, it is replaced. RESTRICTIONS
The script command requires a streams based terminal. In single user mode, streams may not be enabled. Under these circumstances, script will exit with no action. If you are the superuser and need to run this command in single user mode, use the following special instruc- tions. Enabling Streams If it is necessary to enable a streams environment in the single user mode, enter the command /sbin/init.d/streams. This command is avail- able to the superuser only. SEE ALSO
Commands: autopush(8), cat(1), echo(1), strsetup(8), tee(1) System Administration script(1)
All times are GMT -4. The time now is 08:51 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy