Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git Bash: Launch Application via Alias without hanging Bash (WIndows)

Tags:

git

bash

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
like image 943
ctorx Avatar asked Aug 20 '10 03:08

ctorx


People also ask

Where are git bash aliases stored?

A global alias is stored in the global . gitconfig file which is available under the user home directory in Linux, for a local alias it is inside the . git folder within the repository, or you can say “/. git/config” is the relative path for the file.


1 Answers

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

like image 185
VonC Avatar answered Sep 19 '22 18:09

VonC