How to get a result of a cmd into variable?


 
Thread Tools Search this Thread
Special Forums UNIX and Linux Applications How to get a result of a cmd into variable?
# 1  
Old 03-06-2008
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.
# 2  
Old 03-06-2008
It simple as follows if my understanding is write:

I think you wish to store the output in a variable in your shell script. If so, use this:

Var=`autostatus -G jpm_day_today`
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. 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

2. Shell Programming and Scripting

Different cmd to execute and based on some pattern parse it and then store result in xlx format

Hi I have a different requirement, I need to run some application on my device from a file app_name.txt one by one which is like this: /usr/apps/email /usr/apps/message /usr/apps/settings after each app while it is running I need to execute again one cmd like ps -ef |grep... (2 Replies)
Discussion started by: Sanjeev Roy
2 Replies

3. Shell Programming and Scripting

Problem assigning cmd output to variable then using in IF statement

Hi, I'm using the bourn shell on a Sun Solaris Unix system. I am relatively new to UNIX scripting so please bear with me... I'm having a couple issues: 1) I need to have a variable $FSIZE set with the output of a command each time the script runs. (the command looks for a file and... (8 Replies)
Discussion started by: dqrgk0
8 Replies

4. Shell Programming and Scripting

set output of linux cmd as a variable in .exp

I am trying to make a script to take commands from a .txt file ( line by line) and pass it using send ( used in another function ) what i am trying to achieve is : set nol "`grep '' ${exp_path2}/cmdlist.txt | wc -l `" as in shell script nol=`grep '' $exp_path2/cmdlist.txt | wc -l` ... (0 Replies)
Discussion started by: dixyantar
0 Replies

5. 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

6. Shell Programming and Scripting

How to input the return value (1 or 0) ping cmd to a variable

Hi I would like to ask about my plan script I have this several workstation want to monitor and execute a command without logging it we use "rsh $host "<command>" i create csh script using foreach to loop my several workstation, my problem with the rsh command is if it encounter a... (3 Replies)
Discussion started by: jao_madn
3 Replies

7. 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

8. Shell Programming and Scripting

how2 shell cmd into variable

How do I place the result of a shell command into a variable. I would like to save the pwd in $DIR. I tried... pwd | $DIR $DIR < pwd DIR=pwd thanks! jz (2 Replies)
Discussion started by: jwzumwalt
2 Replies

9. UNIX for Dummies Questions & Answers

Redirect to a Variable? Or is it cmd cap?

Hi, Im reading an ANSI text file and greping for a pattern. Then i cut what i dont need from that pattern. So now i just have what i need. What i have now just so happens to be a constant integer. How can i save this integer in a varaible? Or do i use command capture in some form? cat... (2 Replies)
Discussion started by: oxoxo
2 Replies

10. HP-UX

awk to output cmd result

I was wondering if it was possible to tell awk to print the output of a command in the print. .... | awk '{print $0}' I would like it to print the date right before $0, so something like (this doesn't work though) .... | awk '{print date $0}' (4 Replies)
Discussion started by: IMTheNachoMan
4 Replies
Login or Register to Ask a Question