I wanted to set gsettings as /usr/bin/gsettings so I created an alias. But I am not sure if that works:
$ type gsettings
gsettings is aliased to `/usr/bin/gsettings'
gsettings is /home/linuxbrew/.linuxbrew/bin/gsettings
gsettings is /usr/bin/gsettings
$ which gsettings
/home/linuxbrew/.linuxbrew/bin/gsettings
Also another example:
$ type pandoc
pandoc is aliased to `/usr/bin/pandoc'
pandoc is /home/linuxbrew/.linuxbrew/bin/pandoc
pandoc is /usr/bin/pandoc
pandoc is /home/nikhil/.cabal/bin/pandoc
$ which pandoc
/home/linuxbrew/.linuxbrew/bin/pandoc
Question
Can someone please clarify which binary for pandoc and gsettings would get executed when I type
pandocandgsettingson bash?Does the order of output of
typecommand has some significance?
Note
$ type type
type is a function
type ()
{
builtin type -a "$@"
}
type is a shell builtin
which, do you have reason to believe that it's not the one returned bywhich? – user1794469 Jun 30 '20 at 11:35whichis basically a worsetype, you don't need it andtypeis always better.whichwill only check for executables in yourPATH, it will ignore the alias, so it is not relevant here. In fact, it is wrong, since it suggests thatpandocwould run/home/linuxbrew/.linuxbrew/bin/pandoc, when instead it would run/usr/bin/pandocbecause aliases take precedence. See Why not use "which"? What to use then?? – terdon Jun 30 '20 at 11:39