gitbash

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


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

Solution

  • 2010: 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


    2025: I just tested, with:

    npp alias

    And it worked too.

    $ alias npp="\"$(cygpath -u "C:\Program Files\Notepad++\notepad++.exe")\"&"
    $ npp
    [1] 285