Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
and when running a command i kept getting really weird results, namely that eval and echo and various combinations would not run the command
with this "bad" result
and when i dumped the result to a file, it actually had this
finally it came down to my .bashrc file where i had defined
in my script file i used this to temporarily disable grep colors, etc
so it there a better way to turn off the grep options than having to switch this on/off?
Maybe you should ask a different question. Why are you defining options to be applied to every invocation of grep you make in your .bashrc file if you don't want those options to be applied every time you invoke grep?
Have you considered defining an alias for grep that includes the options you want to apply only when grep is invoked interactively?
This User Gave Thanks to Don Cragun For This Post:
Maybe you should ask a different question. Why are you defining options to be applied to every invocation of grep you make in your .bashrc file if you don't want those options to be applied every time you invoke grep?
Have you considered defining an alias for grep that includes the options you want to apply only when grep is invoked interactively?
Because when i grep from the command line i don't want to have to type in this every time.
if i did an alias, it could easily be stomped on by another shell or script running or if i used a different grep like BSD, it would probably choke on an alias.
i'm really looking for something simple that would just strip out the '^[K' formatting characters like with
or
something that recognizes these as not to print or is so dumb that it ignores anything but the displayed string without attributes so that when i pipe something to my script file i don't have turn off or unset switches
You can't have it both ways. If you want to make EVERY invocation of grep use the flags you are setting in GREP_OPTIONS, you are all set. But, as you have seen, that breaks scripts that depend on grep to do what the standards say grep is supposed to do.
If you want interactive invocations of grep to use a specific set of options, use an alias. If you want interactive invocations of grep to use a specific set of options if, and only if, you are running on a Linux system, define an alias for grep in your .bashrc if, and only if, uname indicates that you're starting bash on a Linux system.
Otherwise, I think you have two options:
1. rewrite every shell script you use (provided by you or anyone else) that uses grep,
OR
2. get rid of the definition of GREP_OPTIONS in your .bashrc and add a new utility (mygrep) in your bin directory ($HOME/bin/mygrep) that contains something like:
that you install on Linux systems and on non-Linux systems install a symlink $HOME/bin/mygrep that points to wherever grep is located on that system and learn to use mygrep instead of grep whenever you use it interactively.
Looks like a bug in grep.
It should never add terminal color sequences if output is directed to a file or to a pipe.
Not even when the option-argument is always (as in --color=always)? I don't have a GNU grep to test but I haven't seen where the GNU man page states any exceptions to always in the above case. (Maybe the "on the terminal" in that section of the description means that --color is ignored when output isn't directed to a terminal device, but it doesn't clearly state that behavior.)
Hi all Expertise,
I have following issue to solve,
SSL / TLS Renegotiation DoS (low) 222.225.12.13
Ease of Exploitation Moderate
Port 443/tcp
Family Miscellaneous
Following is the problem description:------------------
Description The remote service encrypts traffic using TLS / SSL and... (2 Replies)
Hi all
system Solaris 10 10/09 s10x_u8wos_08a X86
ufs file system
I would like to install SunStudio.
After the gui comes up it shows that i need to add swap space of at least 900m.
the command swap-s shows 880m free.
My question is can you temporarily increase swap by 1 or 2... (3 Replies)
Issues:
Cron jobs are running everyday at 8PM to hot backup database, archivelog, and some other files.
Sometimes crontab scheduled backups need to be suspended for some other tasks randomly but doesn't happen all the time.
Objective:
I need to create simple script or command ( example :... (7 Replies)
Hi -
I'd like to know if it's possible to change the time on a Unix box temporarily, do some stuff, and then set it back to the correct time.
I'm testing some code that reads a time (in hours) from a config file, and does something at that time. I want to be able to run regression test... (5 Replies)
I want to do just what the title says. Here's why:
I am adapting a script that backups to a mount. In the script it has a catch where if the drive isn't RW then it unmounts and attempts to remount RW.
# attempt to remount the RW mount point as RW; else abort
$MOUNT -o remount,rw... (3 Replies)
hi to all
i'm a newbie on aix.
how would i block temporarily a few users in accessing our aix server so that other users may not be affected by th cpu usage...because if all of them accessing our server the CPU utilization goes high...
thanks
winky (3 Replies)
I want to temporarily disable a user account on HP-UX at the start of a script and renable the account at the end of the script. What would be the best method on HP-UX to temporarily disable a user account? I know of the passwd -l option that will lock the account, but I do not see a flag for... (4 Replies)