views:

87

answers:

3

I'm relearning UNIX commands to use git on windows using MINGW32.

When I launch a program, for example "$ notepad hello.txt" I can't use the shell again until I close the notepad file or CTRL-C in the shell.

How do I essentially fork a new process so I can use both programs?

+1  A: 

Add a & to the end of the command:

notepad hello.txt &
Ignacio Vazquez-Abrams
+5  A: 

Put an ampersand (&) at the end of the command line. That tells the shell to run the program in the background.

In UNIX, you can hit CTRL-z to suspend the currently running program (Instead of CTRL-c to kill it). Once it's suspended, you can use the 'bg' command to put it in the background. I don't think that will work on Windows, but you can try.

JayM
A: 

You can also create an alias in your .rc file so you don't have to add the ampersands each time.

I had some trouble doing this in bash on Cygwin though.

I ended up having to create a separate script file and add an alias to point to it.

Script file contents (filename is "dtextpad"):

#!/bin/bash.exe

C:/Program\ Files/TextPad\ 5/TextPad.exe $@ &

Alias in my .bashrc:

alias tp='~/include/bin/dtextpad'

Now if I want to open a file in textpad, I can type tp filename

DevNull