tags:

views:

36

answers:

2

I've created several bash aliases in Git Bash on Windows, to launch executables from the bash shell.

The problem I am having is that is seems the bash is waiting for an exit code before it starts responding to input again, as once I close the app it launched, it starts taking commands again.

Is there a switch or something I can include in the alias so that bash doesn't wait for the exit code?

I'm looking for something like this...

alias np=notepad.exe --exit
+2  A: 

Follow the command with an ampersand (&) to run it in the background.

Amber
Matthew
Amber
A: 

I confirm what George mentions in the comments:

Launching your alias with '&' allows you to go on without waiting for the return code.

alt text

With:

alias npp='notepad.exe&'

you won't even have to type in the '&'.


But for including parameters, I would recommend a script (instead of an alias) placed anywhere within your path, in a file called "npp":

/c/WINDOWS/system32/notepad.exe $1 &

would allow you to open any file with "npp anyFile" (no '&' needed), without waiting for the return code.

A script like:

for file in $*
do
  /c/WINDOWS/system32/notepad.exe $file &
done

would launch several editors, one per file in parameters:

npp anyFile1 anyFile2 anyFile3

would allow you

VonC
Yes, I get that, but what if I want to execute notepad to open a file as well as not waiting for a return code ?
Matthew
@Matthew: got it. See my updated answer.
VonC