From: Manu B <ma...@us...> - 2002-11-02 10:33:28
|
I'm desperately trying to find an equivalent of "%COMSPEC% /K cmdline" with Bash. With command.com/cmd.exe, the /K switch executes 'cmdline' and remains. I've RTFM and just found the '-c' switch. eg: $ sh --login -i -c 'rm -f toto' With '-c', Bash executes 'rm -f toto' and terminates. IOW, '-c' equals to the '/C' switch of command.com/ cmd.exe. How could I make Bash to execute a command line and stay open. Manu. |
From: Earnie B. <ear...@ya...> - 2002-11-02 12:50:25
|
Manu B wrote: > I'm desperately trying to find an equivalent of > "%COMSPEC% /K cmdline" with Bash. > With command.com/cmd.exe, the /K switch > executes 'cmdline' and remains. > I've RTFM and just found the '-c' switch. > eg: > $ sh --login -i -c 'rm -f toto' > > With '-c', Bash executes 'rm -f toto' and terminates. > IOW, '-c' equals to the '/C' switch of command.com/ > cmd.exe. > > How could I make Bash to execute a command line > and stay open. > Not that I'm aware of. What are you trying to accomplish? Why do you need the subprocess shell to remain open? Could you put the commands in the startup ~/.profile file? Earnie. |
From: Manu B <ma...@us...> - 2002-11-02 14:15:32
|
Earnie Boyd wrote: > Manu B wrote: > > I'm desperately trying to find an equivalent of > > "%COMSPEC% /K cmdline" with Bash. > > With command.com/cmd.exe, the /K switch > > executes 'cmdline' and remains. > > I've RTFM and just found the '-c' switch. > > eg: > > $ sh --login -i -c 'rm -f toto' > > > > With '-c', Bash executes 'rm -f toto' and terminates. > > IOW, '-c' equals to the '/C' switch of command.com/ > > cmd.exe. > > > > How could I make Bash to execute a command line > > and stay open. > > > > Not that I'm aware of. What are you trying to accomplish? Why do you > need the subprocess shell to remain open? Could you put the commands in > the startup ~/.profile file? Well, I'd prefer to keep my intentions secret until I succeed... never mind. Do you know "DOS Prompt Here" from IE 4 power toys? It's an .inf script which add the following key into the registry: REGEDIT4 [HKEY_CLASSES_ROOT\Drive\shell\DosHere\command] @="C:\\WINDOWS\\command.com /k cd \"%1\"" Then, when you right-click on a folder or drive in Windows Explorer, and click the "DOS Prompt Here" sub-menu, "command /k cd \"%1\"" opens a brand new DOS box and 'cd' to the directory pointed by %1. Nice isn't it? Now, when you are used to that "DOS Here" menu, it's natural to think to a "MSYS here" menu in Windows Explorer :) Using MSYS as a build environment is great, it would be wonderful to use the MSYS Bash shell instead of our (stupid) DOS boxes. d:] Manu. |
From: Earnie B. <ear...@ya...> - 2002-11-03 02:19:19
|
Manu B wrote: > Earnie Boyd wrote: > > Well, I'd prefer to keep my intentions secret until I succeed... never mind. > Do you know "DOS Prompt Here" from IE 4 power toys? It's an .inf script > which add the following key into the registry: > > REGEDIT4 > > [HKEY_CLASSES_ROOT\Drive\shell\DosHere\command] > @="C:\\WINDOWS\\command.com /k cd \"%1\"" > > Then, when you right-click on a folder or drive in Windows Explorer, > and click the "DOS Prompt Here" sub-menu, "command /k cd \"%1\"" > opens a brand new DOS box and 'cd' to the directory pointed by %1. > > Nice isn't it? > Now, when you are used to that "DOS Here" menu, it's natural to think > to a "MSYS here" menu in Windows Explorer :) > Using MSYS as a build environment is great, it would be wonderful to > use the MSYS Bash shell instead of our (stupid) DOS boxes. d:] > It's explaned in the cy...@cy... list. You still may not be able to execute the command at execution. Earnie. |
From: Luke D. <cod...@ho...> - 2002-11-03 10:21:34
|
Perhaps you could try writing a batch file that invokes bash. You need to be aware that the /etc/profile script does "cd $HOME" so you can't change to the desired directory before invoking bash. However, you could probably store the directory path in an environment variable and chdir to it in your ~/.profile script. You might wish to modify /etc/profile but I don't recommend it because it will be overwritten if you install a new version of MSYS. Luke ----- Original Message ----- From: "Manu B" <ma...@us...> To: <Min...@li...> Sent: Saturday, November 02, 2002 10:17 PM Subject: Re: [Mingw-msys] Invoking Bash > Earnie Boyd wrote: > > > > Manu B wrote: > > > I'm desperately trying to find an equivalent of > > > "%COMSPEC% /K cmdline" with Bash. > > > With command.com/cmd.exe, the /K switch > > > executes 'cmdline' and remains. > > > I've RTFM and just found the '-c' switch. > > > eg: > > > $ sh --login -i -c 'rm -f toto' > > > > > > With '-c', Bash executes 'rm -f toto' and terminates. > > > IOW, '-c' equals to the '/C' switch of command.com/ > > > cmd.exe. > > > > > > How could I make Bash to execute a command line > > > and stay open. > > > > > > > Not that I'm aware of. What are you trying to accomplish? Why do you > > need the subprocess shell to remain open? Could you put the commands in > > the startup ~/.profile file? > > Well, I'd prefer to keep my intentions secret until I succeed... never mind. > Do you know "DOS Prompt Here" from IE 4 power toys? It's an .inf script > which add the following key into the registry: > > REGEDIT4 > > [HKEY_CLASSES_ROOT\Drive\shell\DosHere\command] > @="C:\\WINDOWS\\command.com /k cd \"%1\"" > > Then, when you right-click on a folder or drive in Windows Explorer, > and click the "DOS Prompt Here" sub-menu, "command /k cd \"%1\"" > opens a brand new DOS box and 'cd' to the directory pointed by %1. > > Nice isn't it? > Now, when you are used to that "DOS Here" menu, it's natural to think > to a "MSYS here" menu in Windows Explorer :) > Using MSYS as a build environment is great, it would be wonderful to > use the MSYS Bash shell instead of our (stupid) DOS boxes. d:] > > Manu. |
From: Manu <ma...@wa...> - 2002-11-03 14:03:56
|
"Luke Dunstan" wrote: > Perhaps you could try writing a batch file that invokes bash. I copied msys.bat to bin/msys-here.bat with these changes: rem if EXIST bin cd bin start rxvt -sl 2500 -fg %FGCOLOR% -bg %BGCOLOR% -sr -fn Courier-12 -tn msys -e /bin/sh --login -i -c "cd '%2' ; exec /bin/sh" Then, a registry key: REGEDIT4 [HKEY_CLASSES_ROOT\Directory\shell\MsysHere] @="&Msys Here" [HKEY_CLASSES_ROOT\Directory\shell\MsysHere\command] @="c:\\dev\\msys\\1.0\\bin\\msys-here.bat MINGW \"%1\"" This is inspired of "CygwinHere" powertoy. (Thanks Earnie BTW) Then, there's still a problem to find rxvt.exe, sh.exe in the path, it works only if I right-click in "c:/dev/msys/bin". Other problem, MSYS doesn't understand "c:\my_dir". MSYS would understand "c:/my_dir", but this is not what Windows Explorer returns. > You need to be > aware that the /etc/profile script does "cd $HOME" so you can't change to > the desired directory before invoking bash. However, you could probably > store the directory path in an environment variable and chdir to it in your > ~/.profile script. You might wish to modify /etc/profile but I don't > recommend it because it will be overwritten if you install a new version of > MSYS. Yes, I agree. Manu. |
From: Luke D. <cod...@ho...> - 2002-11-04 01:44:43
|
----- Original Message ----- From: "Manu" <ma...@wa...> To: "mingw-msys" <min...@li...> Sent: Sunday, November 03, 2002 10:05 PM Subject: Re: [Mingw-msys] Invoking Bash > "Luke Dunstan" wrote: > > > > Perhaps you could try writing a batch file that invokes bash. > > I copied msys.bat to bin/msys-here.bat with these changes: > > rem if EXIST bin cd bin > > start rxvt -sl 2500 -fg %FGCOLOR% -bg %BGCOLOR% -sr > -fn Courier-12 -tn msys -e /bin/sh --login -i -c "cd '%2' ; exec /bin/sh" > > Then, a registry key: > > REGEDIT4 > > [HKEY_CLASSES_ROOT\Directory\shell\MsysHere] > @="&Msys Here" > > [HKEY_CLASSES_ROOT\Directory\shell\MsysHere\command] > @="c:\\dev\\msys\\1.0\\bin\\msys-here.bat MINGW \"%1\"" > > This is inspired of "CygwinHere" powertoy. (Thanks Earnie BTW) > Then, there's still a problem to find rxvt.exe, sh.exe in the path, it > works only if I right-click in "c:/dev/msys/bin". That's because the current directory when running the batch file is set to the directory you clicked on, which is not how msys.bat normally runs. You should be able to just put "cd c:\dev\msys\1.0\bin" at the start of your batch file. > > Other problem, MSYS doesn't understand "c:\my_dir". MSYS would > understand "c:/my_dir", but this is not what Windows Explorer returns. > Yes, backslashes are special characters in bash so they need to be doubled like in C, or enclosed in quotes. Maybe you could write a script/program that converts it like cygpath, or you could try a different version of "bash here" like using environment vars and .profile. > > You need to be > > aware that the /etc/profile script does "cd $HOME" so you can't change to > > the desired directory before invoking bash. However, you could probably > > store the directory path in an environment variable and chdir to it in your > > ~/.profile script. You might wish to modify /etc/profile but I don't > > recommend it because it will be overwritten if you install a new version of > > MSYS. > > Yes, I agree. > > Manu. Luke |
From: Manu <ma...@wa...> - 2002-11-04 19:45:35
|
Luke Dunstan wrote: > > ----- Original Message ----- > From: "Manu" > To: "mingw-msys" <min...@li...> > Sent: Sunday, November 03, 2002 10:05 PM > Subject: Re: [Mingw-msys] Invoking Bash > > > > "Luke Dunstan" wrote: > > > > > > > Perhaps you could try writing a batch file that invokes bash. > > > > I copied msys.bat to bin/msys-here.bat with these changes: > > > > rem if EXIST bin cd bin > > > > start rxvt -sl 2500 -fg %FGCOLOR% -bg %BGCOLOR% -sr > > -fn Courier-12 -tn msys -e /bin/sh --login -i -c "cd '%2' ; exec /bin/sh" > > > > Then, a registry key: > > > > REGEDIT4 > > > > [HKEY_CLASSES_ROOT\Directory\shell\MsysHere] > > @="&Msys Here" > > > > [HKEY_CLASSES_ROOT\Directory\shell\MsysHere\command] > > @="c:\\dev\\msys\\1.0\\bin\\msys-here.bat MINGW \"%1\"" > > > > This is inspired of "CygwinHere" powertoy. (Thanks Earnie BTW) > > Then, there's still a problem to find rxvt.exe, sh.exe in the path, it > > works only if I right-click in "c:/dev/msys/bin". > > That's because the current directory when running the batch file is set to > the directory you clicked on, which is not how msys.bat normally runs. You > should be able to just put "cd c:\dev\msys\1.0\bin" at the start of your > batch file. Yes, good idea. > > Other problem, MSYS doesn't understand "c:\my_dir". MSYS would > > understand "c:/my_dir", but this is not what Windows Explorer returns. > > > > Yes, backslashes are special characters in bash so they need to be doubled > like in C, or enclosed in quotes. Maybe you could write a script/program > that converts it like cygpath, or you could try a different version of "bash > here" like using environment vars and .profile. Yes, I'll try to find a solution. I'd really like to use MSYS instead of DOS boxes. BTW, there's another CygwinPromtHere which writes the directory to a temp file, I think. Maybe an alternative. Manu. PS: One trillion thanks for telling me about the 'specs' file in MinGW. |
From: Soren A <sor...@fa...> - 2002-11-04 22:29:03
|
On Mon, 04 Nov 2002 19:53:50 GMT, "Manu" <ma...@wa...> wrote in news:000e01c2843c$6d690ae0$d6aefac1@net: >> > Other problem, MSYS doesn't understand "c:\my_dir". MSYS would >> > understand "c:/my_dir", but this is not what Windows Explorer >> > returns. >> Yes, backslashes are special characters in bash so they need to be >> doubled like in C, or enclosed in quotes. Maybe you could write a >> script/program that converts it like cygpath, or you could try a >> different version of "bash here" like using environment vars and >> .profile. > Yes, I'll try to find a solution. I'd really like to use MSYS instead > of DOS boxes. > BTW, there's another CygwinPromtHere which writes the directory to a > temp file, I think. Maybe an alternative. Yes. There are now several versions of the "Cygwin/Bash Here" concept that have been discussed on the Cygwin List, as you've seen. I was going to get around to this sooner or later (making an "MSYS" version of the same thing), having just recently (finally) gotten a Cygwin bash version det up and working -- but you've beaten me to it. But (without having tried it) cannot the Registry entry enclose the dir arg in single quotes? That would protect the backslashes from special bash interpolation and allow the path arg to work. Best, Soren A |