Can I return a value from tclproc to my ksh script?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Can I return a value from tclproc to my ksh script?
# 1  
Old 03-20-2006
Can I return a value from tclproc to my ksh script?

Hi all, I have a ksh script that calls a tcl proc that sets a variable that I am attempting to return to the calling script? Is this possible or does the tcl variable live in its own space that I cannot access from ksh.

I have tried the following but when I do the var in my script is empty although the tclproc processes correctly:

varname=`tclproc call blah blah`

I have a statement at the end of the tclproc that states return $var

Any help would be appreciated

David
# 2  
Old 03-20-2006
I don't know tcl, but instead of return, you must write the value to stdout for the backtick construct to pick it up. Try echo or print, something like that.
# 3  
Old 03-20-2006
I had actually already considered writing the variable from tcl to a file that I could then access when I returned to my script. I guess I am more interested in seeing whether the return value can be accessed once execution is returned to the script.

Thx though

David
# 4  
Old 03-20-2006
To a file?
varname=`tclproc call blah blah`
will work fine. See those quotes you used? They are backticks. They pick up what the enclosed command outputs.
# 5  
Old 03-21-2006
Hi, you would think the backticks would work but they don't, I get an empty string as the result.

Anyone?
# 6  
Old 03-21-2006
Then you didn't write anything to stdout. Try this command:
date

See how the date and time appears on your screen? That is because the date command wrote some characters to stdout. Now try this:
x=`date`
echo x = $x

Now x has been set to the date and time. Now you need to work on your script until you can do:
tclproc call blah blah
and see some output on your screen. Then you are ready to use the backticks to pick it up.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Return: can only `return' from a function or sourced script

Not sure where the problem is. I can run the script without any issue using the following command. . /opt/app/scripts/cdc_migration.sh But it fails with the below error when I try it this way /opt/app/scripts/cdc_migration.sh /opt/app/scripts/cdc_migration.sh: line 65: return: can only... (1 Reply)
Discussion started by: svajhala
1 Replies

2. Shell Programming and Scripting

Need output of script on screen and file with correct return status of the called script.

Hi, I am trying to capture logs of the script in the file as well as on the screen. I have used exec and tee command for this. While using exec command I am getting the correct output in the file but, script output is not getting displayed on the screen as it get executed. Below is my sample... (14 Replies)
Discussion started by: Prathmesh
14 Replies

3. Shell Programming and Scripting

ksh string replacement over a carriage return

Hi. I need to make multiple string replacements in a file but several of the strings have been broken up by a carriage return so that the first few characters are on one line and the remainder on the following line. E.g like the word 'post' in the following: Use descriptive thread... (3 Replies)
Discussion started by: Big_Jeffrey
3 Replies

4. Shell Programming and Scripting

Return value inside isql to a shell variable in ksh

Hello, I have a shell script where I am doing an isql to select some records. the result i get from the select statement is directed to an output file. I want to assign the result to a Shell variable so that I can use the retrieved in another routine. e.g. "isql -U${USER} -P${PASSWD} -S${SERVER}... (1 Reply)
Discussion started by: RookieDev
1 Replies

5. Shell Programming and Scripting

Carriage return ksh

Hello, How do i usecarriage return in ksh. I want to do an echo "bla bla" and another echo "bla bla" will appear and replace the first echo on screen. I tried: until ; do echo "bla bla \r" done please advice. Thanks. (3 Replies)
Discussion started by: LiorAmitai
3 Replies

6. Shell Programming and Scripting

KSH script to run other ksh scripts and output it to a file and/or email

Hi I am new to this Scripting process and would like to know How can i write a ksh script that will call other ksh scripts and write the output to a file and/or email. For example ------- Script ABC ------- a.ksh b.ksh c.ksh I need to call all three scripts execute them and... (2 Replies)
Discussion started by: pacifican
2 Replies

7. Shell Programming and Scripting

Get return value from PERL script calling from KSH

All: I am calling a PERL script from KSH. I need specific codes to be returned by the PERL Script. For ex: Ksh ----- result=`test.pl $FILE` My idea is to get the value of result from the test.pl, by specifically making the test.pl to print the return code. Since I had some other print... (1 Reply)
Discussion started by: ucbus
1 Replies

8. Shell Programming and Scripting

KSH Functions String return

Hy everybody I'm trying to write a function like function(){ final=$1 return $final } but I get following error: "return: bad non-numeric arg ''" what shall I do? Isn't it possible to return strings?:confused: thanks lucae (2 Replies)
Discussion started by: lucae
2 Replies

9. Shell Programming and Scripting

ksh script as a login shell return "no controlling terminal"

I have created a ksh shell script and used it as a login shell for a user. </etc/passwd> lramirev:x:111:200:Luis:/export/home/menush:/usr/local/menush/menush My shell script is like this: </usr/local/menush/menush> #!/bin/ksh # if ] then . $HOME/.profile fi ... (8 Replies)
Discussion started by: lramirev
8 Replies

10. Shell Programming and Scripting

import var and function from ksh script to another ksh script

Ih all, i have multiples ksh scripts for crontab's unix jobs they all have same variables declarations and some similar functions i would have a only single script file to declare my variables, like: var1= "aaa" var2= "bbb" var3= "ccc" ... function ab { ...} function bc { ... }... (2 Replies)
Discussion started by: wolfhurt
2 Replies
Login or Register to Ask a Question