How to use env command to change GREP_OPTIONS variable?


 
Thread Tools Search this Thread
Top Forums UNIX for Beginners Questions & Answers How to use env command to change GREP_OPTIONS variable?
# 1  
Old 11-23-2016
Question How to use env command to change GREP_OPTIONS variable?

How could I use the env command to change the enviroment variable GREP_OPTIONS so that grep is not case sensitive by setting it to "-i'?

So that the command:
Code:
grep a <<< A

Will produce the same output as

Code:
grep -i a <<< A

# 2  
Old 11-24-2016
Any attempts/ideas/thoughts from your side? What would man env say?
This User Gave Thanks to RudiC For This Post:
# 3  
Old 11-24-2016
Would
Code:
env $GREP_OPTIONS="-i"

work?


*EDIT:*
Actually I got
Code:
env GREP_OPTIONS=-i grep a <<< A

to work.

Code:
env GREP_OPTIONS=-i grep a <<< A
A


Last edited by steezuschrist96; 11-24-2016 at 11:14 AM..
# 4  
Old 11-24-2016
What happened when you tried it on your server? I would expect a syntax error from env $GREP_OPTIONS="-i"

Try:-
Code:
GREP_OPTIONS="-i"            # Assign the value to the variable
grep a <<< A                 # Test it


Does that help?


Robin
This User Gave Thanks to rbatte1 For This Post:
# 5  
Old 11-24-2016
Looks like he sneak-edited after your question.
# 6  
Old 11-24-2016
I'm so sneaky with my large *EDIT:* tag.
# 7  
Old 11-24-2016
Quote:
Originally Posted by steezuschrist96
I'm so sneaky with my large *EDIT:* tag.
Note that your "large *EDIT:* tag", is exactly the same size as the rest of the text in your post (so I'm not sure what "large" means in this case). Smilie

Note also that anyone subscribed to your thread will receive notification by e-mail when a new post is added to your thread after the current contents have been read; but will receive no notice when you edit a post. And, if someone trying to help you is editing a response to one of your posts, there isn't much incentive to go back and look for changes in posts that have already been read -- unless you add a new post pointing out that earlier text has been modified. Smilie

Those of us who read a lot of threads in this forum and try to help out by answering questions appreciate it when new information is added by submitting a new post to the thread instead of by editing an existing post. Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Treat value of variable as env variable

Hi All, I have a requirement where I have a config file, which contains 2 coulmn.values of first column are environmnet variable, whose value is defined in an environment file. In my script I need to read the config file, and get the value of the config file variable from env file. I... (2 Replies)
Discussion started by: alok2082
2 Replies

2. Web Development

Deny from env=env-variable Does not work

(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

3. Shell Programming and Scripting

Perl Csh - setenv ENV change environment variable

I have 3 programs, 1 in perl, 2 in csh: call them perl1, csh1 and run.ol I need perl1 to set csh1 variable NOLOG_qsub = "" I need perl1 to run, run.ol run.ol takes the executable and input and outputs to output run.ol#!/bin/csh -f # run.ol executable input output perl1 should... (1 Reply)
Discussion started by: austinj
1 Replies

4. Shell Programming and Scripting

Env variable

Hello, I want to cange env variable on SunOS. I tried: export GONGA=$GONGA:/users/BANK1/basic/queues/SARON_SPACE1 it changed it only localy for my session. when i opened a new session (telnet etc') the old value exist. How can I change it to effact all sessions. Thanks. (2 Replies)
Discussion started by: LiorAmitai
2 Replies

5. Shell Programming and Scripting

how can i change value of incorrect env variable?

Hi, I have ORACLE_HOME= This is wrong, and I want to find this in the file, and replace it with ORACLE_HOME=/home/oracle/product/10.2 can anyone please assist? thanks (2 Replies)
Discussion started by: JamesByars
2 Replies

6. Shell Programming and Scripting

how to reuse a shell script to change env from perl

Hi: I am trying to reuse an existing shell script foo1.csh to set environment variables inside a perl script and its childern processes. Is it possible at all to make those environment variables persistent in the main perl process and its children processes? Do I have to create a new... (4 Replies)
Discussion started by: phil518
4 Replies

7. UNIX for Dummies Questions & Answers

Env Variable

Hi, I have a doubt on Environment variable. I want to know where and when the envirnment variables are defined? Thanks & Regards, Siba (1 Reply)
Discussion started by: siba.s.nayak
1 Replies

8. UNIX for Dummies Questions & Answers

PWD env variable

Could you please tell me, which process / file is responsible for the setting of PWD env variable in Solaris Thanks (1 Reply)
Discussion started by: chaandana
1 Replies

9. Solaris

Root ENV is different from users', how to change?

Hello, I'm working on a Solaris 9 machine. I found the root's environment variables (say, $PATH, $ORACLE_HOME, big problem) were set differently from the users'. All regular users use C shell now and share the same environment file stored in /usr/local/config/cshrc.default. Should I just use... (4 Replies)
Discussion started by: alanlh
4 Replies

10. Shell Programming and Scripting

Adding command line env in cron env

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
Login or Register to Ask a Question