I would like to know if there is any difference between using ampersand character (&) before command arguments or after command arguments when you try to run a GNU/LINUX command in background:
ls directory &
vs
ls & directory
I have always been teached to use ampersand after arguments, so maybe I am missing something here.
I am a Windows user and I am using Cygwin as my terminal. In order to run notepad++ from terminal I have added this lines to ~/.bash_profile:
npp () {
/cygdrive/d/Notepad++/notepad++.exe $(cygpath -w -- "$@")
}
it worked, so next I needed a way to launch it on the background so I could open a npp++ instance without stopping my terminal flow. This worked:
npp foo &
But I did not want to introduce that ampersand manually, so I tried adding this alias to ~/.bash_profile:
alias npp="npp &"
And now:
npp foo
Works in the background. So I would like to know if I am missing something here, If there is any difference between using ampersand before or after command argument, or if there is a better approach to this problem.
برچسب:
نویسنده: استخدام کار