Sponsored Content
Top Forums Shell Programming and Scripting populate variable from remote result Post 302107532 by hcclnoodles on Monday 19th of February 2007 04:23:09 AM
Old 02-19-2007
populate variable from remote result

Hi there

i am trying to pass the result of a remote command into a variable into my script

ie
Code:
#!/bin/sh

var = `ssh remote_box 'uname'`
echo $var

but all i get back is

Code:
./script.sh[3]: var:  not found


However when i add a -x to put it into diag mode i get the following

Code:
+ ssh remote_server uname
+ var = SunOS
./script[3]: var:  not found
+ echo

so it looks like the variable var is actually being populated but i cant echo it


does anybody know what im doing wrong here?

Cheers
Gary
 

10 More Discussions You Might Find Interesting

1. UNIX and Linux Applications

How to get a result of a cmd into variable?

Hi , I am trying following . I need to get a result of an autosys cmd into a unix variable. The autosys cmd is autostatus -G jpm_day_today Please help me in storing the value returned by this cmd into a unix variable. Appreciate your time to read this post. (1 Reply)
Discussion started by: manchau
1 Replies

2. Shell Programming and Scripting

running command remotely to populate local variable

If I run this # ssh remote-server 'du -sk /usr/platform/`uname -i`/' 174 /usr/platform/SUNW,Sun-Fire-V245 I get my output just fine, However, if i try to do the same but populate a local variable within my script called for example 'result' #!/bin/ksh result=`ssh remote-server... (3 Replies)
Discussion started by: hcclnoodles
3 Replies

3. Shell Programming and Scripting

Assign result to variable

Hi friends, firstly, i can run following expression and i took 100 value. sqlplus -s username/password@TTTEST @umt.sql umt.sql exists "select t.deger from parametre t where t.id=30". result of this query =100 i need to assign this value(100) to variable(for example x... (2 Replies)
Discussion started by: temhem
2 Replies

4. Shell Programming and Scripting

PHP populate variable with function

Hi, I've a php scirpt that calls in an external class. The external class, myClass, has several public and private functions. There is one public function which derives a value that I want be able to bring it to the main php scirpt. Here is the code. ....snip.... include... (1 Reply)
Discussion started by: nitin
1 Replies

5. Shell Programming and Scripting

populate a bash variable from an awk operation

Hi, I'm trying to populate bash script variable, data_size with the size of the largest file in my current directory data_size=$(ls -lS | grep -v "total" | head -1) | awk '{ print $5 }' I've tried adding an echo before the call to awk data_size=$(ls -l | grep -v "total" | head -1) |... (2 Replies)
Discussion started by: mark_s_g
2 Replies

6. Shell Programming and Scripting

result in variable

Hi all, I'll try to get a result from a search with "awk" into a variable. It works for those examples: findfirstline=`awk 'BEGIN{ mycount = 1 } { if(mycount == 1 && /^Video/){ row=NR; print row; mycount = 0; }}' ${i}` findlastline=`awk '/^Video/ {row=NR} END{print row}' ${i}` But it... (6 Replies)
Discussion started by: tempestas
6 Replies

7. Shell Programming and Scripting

How to combine two variable result?

Hi, i have two variables i.e lck_ckm_customer=ckm_customer and(present in some script A) table=ckm_customer(present in script B) in script B i am executing this part if ; then --- ---- ---- fi Now, while comparing in my log file i am getting this result if but i... (2 Replies)
Discussion started by: gnnsprapa
2 Replies

8. Shell Programming and Scripting

Result of 'cut' into variable

Hello, I would like to have a result of a cut-command in a variable. The file "t.dat" has the following content: Company 001.239879123.OB1X.672W12.STS UNOLD.001.02 My bash-script: Header="" Header=$(cut -c1-160 t.dat | head -1) echo $Header ... (9 Replies)
Discussion started by: API
9 Replies

9. Shell Programming and Scripting

How to store remote variable from remote cat file ??

I am trying to cat on a file located on remote server and assign it to remote variable. I have both local and remote variables. Running below script from local. test.sh J_NAME=XXX2 J_IP=XXX ssh $J_IP "ps auxw |grep java | grep -v grep |grep $J_NAME | awk '{print ... (2 Replies)
Discussion started by: oraclermanpt
2 Replies

10. Shell Programming and Scripting

Store result variable

Friends have the following problem: cat $PATH_DAT/mr.txt | nawk 'BEGIN { CantPnt=0; NumReg=0; FS="|" } { NumReg++ CantPnt=CantPnt+int($2) } END{ printf... (5 Replies)
Discussion started by: tricampeon81
5 Replies
dtappsession(1) 						   User Commands						   dtappsession(1)

NAME
dtappsession - start a new Application Manager session SYNOPSIS
/usr/dt/bin/dtappsession [hostname] DESCRIPTION
dtappsession is a specialized version of the Xsession shell script. It is an alternative to using the CDE remote login that allows you to access a remote host without logging out of your current CDE session. dtappsession starts a new instance of the CDE Application Manager in its own ToolTalkTM session. It can be used to remotely display the Application Manager back to your local display after logging in to a remote host with the rlogin(1) command. A new, independent instance of ttsession(1) starts a simple session management window. This window displays the title remote_hostname: Remote Administration where remote_hostname is the system that is being accessed. The window also displays an Exit button. Clicking Exit terminates the ToolTalk session and all windows that are part of the session. The Application Manager that is displayed can be used to start remote CDE actions to run in this session. Exiting the Application Manager does not terminate the session, and it is not recommended. Clicking Exit is the recommended way to end the session. To avoid confusing the remote CDE applications with local ones, it is recommended that a new CDE workspace be created for clients in the remote session. The hostname is not needed when the DISPLAY environment variable is set to the local hostname on the remote host. On a system that is configured with Trusted Extensions, dtappsession can be used for remote administration by administrative roles that have the ability to log in to the remote host. dtappsession does not require any privilege, and it does not need to run on a system that is configured with Trusted Extensions. When installed in /usr/dt/bin on a Solaris system, along with the startApp.ds file, dtappsession can be used to administer the remote Solaris system from a local system that is configured with Trusted Extensions. However, in this case, the CDE workspace that is used for remote display must be a normal workspace, rather than a role workspace. EXAMPLES
Example 1 Remote Login and dtappsession After creating a new CDE workspace, type the following in a terminal window: # rlogin remote_hostname password: /*type the remote password*/ # dtappsession local_hostname /* on the remote host */ FILES
/usr/dt/bin/startApp.ds dt Korn shell script for session manager window ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWdttsu | +-----------------------------+-----------------------------+ |Interface Stability |Committed | +-----------------------------+-----------------------------+ BUGS
X11/CDE applications that do not register with the ToolTalk session manager will not exit automatically when the session is terminated. Such applications must be explicitly terminated. SEE ALSO
dtfile(1), rlogin(1), ttsession(1), attributes(5) Chapter 14, Remote Administration in Trusted Extensions (Tasks), in Solaris Trusted Extensions Administrator's Procedures NOTES
The functionality described on this manual page is available only if the system is configured with Trusted Extensions. SunOS 5.11 15 Aug 2005 dtappsession(1)
All times are GMT -4. The time now is 05:22 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy