![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Results of command execution into array | alirezan | Shell Programming and Scripting | 2 | 08-18-2008 11:17 PM |
| Iteration through the results from a unix command | deviprasad83 | Shell Programming and Scripting | 4 | 06-12-2008 04:04 AM |
| joining command results, and substitution | ncatdesigner | Shell Programming and Scripting | 6 | 04-17-2008 11:37 AM |
| Setting the Results of a Command to a Variable | stky13 | UNIX for Dummies Questions & Answers | 1 | 02-29-2008 03:00 PM |
| How to output the results of the AT command - properly! | SpanishPassion | UNIX for Dummies Questions & Answers | 4 | 12-04-2005 10:27 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
getting results after using ps command
Hi,
I want to use the following ps coomand: ps -ef | grep test Result of this command is: Test 161220 1 0 Oct 04 - 1:11 /test/test Just mentioning the description of each value in the result: UID PID PPID C STIME TTY TIME CMD Test 161220 1 0 Oct 04 - 1:11 /test/test NOW the requirement is to check the 'TTY' value and 'TIME' value. I have to do certain operations if TTY = '-' and TIME !=0:00 ..........Please help me how to do that? Thanks. |
|
||||
|
Thanks Vidyadhar,
It is giving error, saying no match for if.....I tried by putting fi...did not work....also it is not any file in which I will have TIME and TTY..........Actually in my shell script I will execute "ps -ef | grep test" command first and then in the second line I want to do that operation on the result set of "ps -ef | grep test" command. I think we should check 6th (TTY) and 7th (TIME) column values. Please suggest. |
|
||||
|
I tried something like that.....
ps -ef | grep test if [ `ps -efo tty,time,args|awk '/test/{print $1}'` -eq '-' -a `ps -efo tty,time,args|awk '/test/{print $2}'` -ne "0:00" ] then 1 fi error message was: 0403-057 Syntax error: `fi' is not expected. |
![]() |
| Bookmarks |
| Tags |
| filter values, ps command |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|