Sponsored Content
Full Discussion: If condition help required
Top Forums Shell Programming and Scripting If condition help required Post 302851919 by krishmaths on Tuesday 10th of September 2013 04:54:37 AM
Old 09-10-2013
Code:
x=$(ps -fu myuserid | grep [j]ava | awk '{print $2}')
if [ ! -z $x ]
then
  echo process is running
else
  echo process not running
fi

This User Gave Thanks to krishmaths For This Post:
 

10 More Discussions You Might Find Interesting

1. Programming

help required

hi i am new to c programming and found this on the net could someone tell me what it actually does, many thanks in advance cheers #include <fcntl.h> main() { int fd; fd = open("in1", O_RDONLY); printf("%d\n", fd); } and this too please #include <fcntl.h> main() { int... (1 Reply)
Discussion started by: ruffenator
1 Replies

2. UNIX for Dummies Questions & Answers

help required

Hi All, Please help me in the following query need a command to get all the files in the present directory except the next day file format :: abc_<DD>.log $ls -l abc_10.log abc_10.log abc_11.log Now i need the output in abc.list which should contains $more abc.list abc_10.log... (5 Replies)
Discussion started by: thaduka
5 Replies

3. Shell Programming and Scripting

End of loop condition required???

Hi i have a variable with lots of tokens seperated with spaces. e.g VAR="ABC DEF GHSD GHQS TUTSD JHDTQ QDHQ CDQKDGQ WQUTQD DQUTQD DQJGDQ QDTQD WDQUTQDU QDUGQD QDJGQD DQUTDUQ QDUIDTQ" i want to separate all of the above tokens and call a script with each of the token e.g sh script.sh <TOKEN>... (4 Replies)
Discussion started by: skyineyes
4 Replies

4. Shell Programming and Scripting

Please Help required.

Hello guys I am new to awk programming. I need the below required script which can perform the following. I have a file containing below data. SNA NoCRD = 131 SNA OBarr = 3 SNC NoCRD = 76 SNC OBarr = 1 SND NoCRD = 155 SND OBarr = 5 SNE NoCRD = 100 SNE OBarr = 1 SNF NoCRD = 131 SNF... (2 Replies)
Discussion started by: jurial
2 Replies

5. Shell Programming and Scripting

Help Required

Below is my code which gives output like this: Every time we have to open the script file and change the value of TG in BEGIN. what i want to do is that i give two three values at the sametime and then run the script and it gives output one by one at the same time. I think i have to define... (2 Replies)
Discussion started by: wakhan
2 Replies

6. Shell Programming and Scripting

Getting required fields from a test file in required fromat in unix

My data is something like shown below. date1 date2 aaa bbbb ccccc date3 date4 dddd eeeeeee ffffffffff ggggg hh I want the output like this date1date2 aaa eeeeee I serached in the forum but didn't find the exact matching solution. Please help. (7 Replies)
Discussion started by: rdhanek
7 Replies

7. HP-UX

Difference between [condition] and [[condition]] and ((condition)) when used with if condition

Executed the following if conditions .. and got different results . only (( )) gave correct o/p with all scenarios . Can anybody please let me know what is the difference between and ] and ((condition)) when used with if condition. And why each condition gave different result. 1.... (2 Replies)
Discussion started by: soumyabubun
2 Replies

8. Shell Programming and Scripting

redirect stdout echo command in condition A run in condition B

hi, I have some problems in my simple script about the redirect echo stdout command inside a condition. Why is the echo command inside the elif still execute in the else command Here are my simple script After check on the two diff output the echo stdout redirect is present in two diff... (3 Replies)
Discussion started by: jao_madn
3 Replies

9. Shell Programming and Scripting

Help with extract info if fulfill condition required

Input file (4 DATA record shown in this case): DATA AA0110 ACCESSION AA0110 VERSION AA0110 GI:157412239 FEATURES Location/Qualifiers length 1..1170 1..1700 /length="1170" position ... (5 Replies)
Discussion started by: perl_beginner
5 Replies

10. Shell Programming and Scripting

If condition return 0 even when it fails to satisfy te condition

HI My doubt may be basic one but I need to get it clarified.. When i use "if" condition that checks for many AND, OR logical conditions like if ]; then return 0 fi Even the if condition fails it returns as zero.. Any clue.. But if i add else condition like if ]; ... (2 Replies)
Discussion started by: Priya Amaresh
2 Replies
ZGREP(1)						      General Commands Manual							  ZGREP(1)

NAME
zgrep - search possibly compressed files for a regular expression SYNOPSIS
zgrep [ grep_options ] [ -e ] pattern filename... DESCRIPTION
Zgrep invokes grep on compressed or gzipped files. These grep options will cause zgrep to terminate with an error code: (-[drRzZ]|--di*|--exc*|--inc*|--rec*|--nu*). All other options specified are passed directly to grep. If no file is specified, then the standard input is decompressed if necessary and fed to grep. Otherwise the given files are uncompressed if necessary and fed to grep. If the GREP environment variable is set, zgrep uses it as the grep program to be invoked. EXIT CODE
2 - An option that is not supported was specified. AUTHOR
Charles Levert (charles@comm.polymtl.ca) SEE ALSO
grep(1), gzexe(1), gzip(1), zdiff(1), zforce(1), zmore(1), znew(1) ZGREP(1)
All times are GMT -4. The time now is 06:03 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy