windows - Running hstart from MSYS
2014-07
I'm trying to automate some things on my computer. And here's what I ran into. I'm running this command from MSYS prompt:
hstart /elevate "cmd /k netstat -anb"
First a message box with title "Failed to create process - Hstart" appears, saying: "C:/Program Files (x86)/Git/elevate" A new non-elevated console is then opened with a message: "The requested operation requires elevation." It works as expected if run from cmd.exe. What is even happening and how to make it work?
It appears MSYS performs automatic paths conversion, if it's to run an executable "not dependent on msys-1.0.dll." So for it work you can double the slash:
hstart //elevate "cmd /k netstat -anb"
To set my default options for grep
(from MSYS in Win7) to ignore object files and specific dirs, I exported
GREP_OPTIONS
to ~/.profile
as follows:
export GREP_OPTIONS='--exclude=*.{o,obj,pyc} --exclude-dir={.git,_Output}'
export GREP_COLOR='1;32'
Even after restarting the shell for my .profile
to take effect, my call to grep
still
searches object files. However, the GREP_COLOR
variable seems to work. I even tried explicitly setting my options in the same shell before executing grep
:
$ grep --version
GNU grep 2.5.4
Copyright (C) 2009 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.
$ export GREP_OPTIONS='--exclude=*.{o,obj,pyc} --exclude-dir={.git,_Output}'
$ echo $GREP_OPTIONS
--exclude=*.{o,obj,pyc} --exclude-dir={.git,_Output}
$ grep $GREP_OPTIONS -r foo .
grep: ./bar.o: Permission denied
./baz.c:My foo text
$ grep --exclude=*.{o,obj,pyc} --exclude-dir={.git,_Output} -r foo .
./baz.c:My foo text
How do I get grep
to automatically use GREP_OPTIONS
from ~/.profile
?
Try
export GREP_OPTIONS='--exclude="*.{o,obj,pyc}" --exclude-dir={.git,_Output}'
i.e., enclosing the --exclude
filename pattern in (double) quotes.
Try putting the variables in .profile, along with a line that says something like the following:
alias grep='grep $GREP_OPTIONS'
That just might fix it.