edubart / nelua-lang

Minimal, efficient, statically-typed and meta-programmable systems programming language heavily inspired by Lua, which compiles to C and native code.
https://nelua.io
MIT License
2k stars 62 forks source link

'which' versus 'command -v' #54

Closed stefanos82 closed 3 years ago

stefanos82 commented 3 years ago

At https://github.com/edubart/nelua-lang/blob/master/nelua.sh#L29 you use which command which on GNU / Debian is installed as an external binary that is located in /usr/bin/which, that happens to be a classic shell itself.

The question is, what happens if it's not installed?

As far as I know, command -v does the exact thing and it's a builtin command which is also POSIX-compliant.

Would you like to replace it with the aforementioned suggestion?

edubart commented 3 years ago

I didn't know that, if works the same and is more portable we can replace it. If you make a PR and works fine I would accept.

stefanos82 commented 3 years ago

sure thing, let me do so right now.

nsauzede commented 3 years ago

I didn't know that either, but I second the request.

~$ which command || echo error
error
~$ command -v which
/usr/bin/which
~$ 
stefanos82 commented 3 years ago

Done.

stefanos82 commented 3 years ago

By the way, since it got merged, shall I delete the branch?

edubart commented 3 years ago

It's your fork, feel free to manage as you wish, in my case I would probably delete.

stefanos82 commented 3 years ago

Yeah, I will delete it; no need to have it anymore.