12-05-2019
understanding the purpose of <If env | grep -q $EXAMPLE>
I have seen this code in a few places and my understanding is they are using it to determine what app called the script.
I have a script that is called by two different applications and what it to do one thing when called by one and something else when called by the other. How do I determine what app is calling the script? If my example is correct how would I determine the $EXAMPLE and is every running application assigned a variable name?
I thought about just writing a separate script but the script is caching some info from one app and then echoing out to the other app when it asks for it so I think it should stay as one script.
Any help or pointing me in the correct direction would be great.
Thank you,
Jason
10 More Discussions You Might Find Interesting
1. Programming
I'm having difficulty understanding the purposes of using dup/dup2 when involving forks.
for example, if we call fork() once, that is, we are creating a child process. In what cases would we need to use dup or dup2 to duplicate the file descriptors for standard output and standard error? What... (1 Reply)
Discussion started by: Yifan_Guo
1 Replies
2. Shell Programming and Scripting
Hello friends,
i run two scripts manually & they work.
i run them in cron & they don work.
how to match the two env's
1.command line env
2.cron env
i would like cron to use command line env.
Thanks & Regards
Abhijeet (1 Reply)
Discussion started by: abhijeetkul
1 Replies
3. UNIX for Dummies Questions & Answers
Hi Friends,
Can any of you explain me about the below line of code?
mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`
Im not able to understand, what exactly it is doing :confused:
Any help would be useful for me.
Lokesha (4 Replies)
Discussion started by: Lokesha
4 Replies
4. UNIX for Dummies Questions & Answers
What is the purpose of /etc/cron.d? (3 Replies)
Discussion started by: proactiveaditya
3 Replies
5. UNIX for Advanced & Expert Users
Hi All
Can anybody tell me what is the purpose of inv in the below command.
ftp -inv $RFTPSERVER /temp/te.txt << EOF
and << its stands for what..
Thanks (1 Reply)
Discussion started by: raju4u
1 Replies
6. Web Development
(Above from Apache docs).
On my system, using:
SetEnvIf User-Agent Mozilla IsBad=1
Order allow,deny
Allow from all
Deny from env=IsBad ...I see that environment variable is set (using phpinfo()) but the page is still served. No errors in the Apache logs. (1 Reply)
Discussion started by: gnurob
1 Replies
7. Shell Programming and Scripting
I have the following code. I want to remove the --sort=num/num/... and am
using grep to exclude it as shown below:
I have a bit of problem figuring out the use of - at the front
echo "--sort=4/5/6" | grep -ivE '-((sort|group)=+/+(/+)*)$'
Now suppose I want to remove --quiet
I can... (7 Replies)
Discussion started by: kristinu
7 Replies
8. UNIX for Dummies Questions & Answers
Hi,
I have read from the book that , <> causes the file to be used as both input as well as output. Can anyone give me the scenario where <> will be useful?
Thanks (10 Replies)
Discussion started by: pandeesh
10 Replies
9. Shell Programming and Scripting
I have the following line of code that works wonders. I just don't completely understand it as I am just starting to learn regex. Can you help me understand exactly what is happening here?
find . -type f | grep -v '^\.$' | sed 's!\.\/!!' (4 Replies)
Discussion started by: trogdortheburni
4 Replies
10. Shell Programming and Scripting
If I use the grep command for parsing files, does it stop parsing right after it finds the matching pattern or does it continue to parse that document? grep -l "status" *.xml (5 Replies)
Discussion started by: emc^24sho
5 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)