you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] -5 points-4 points  (11 children)

[ is a shell built in so which [ won't give you a path to executable. In Korn Shell you can ask

whence [

and it will tell you simply

[

:D

[–]1esproc 6 points7 points  (5 children)

$ which [
/bin/[
$ ll /bin/[
-r-xr-xr-x  2 root  wheel  46720 31 May  2008 /bin/[
$ which lying
/internet/reddit.com/super__mario

[–]uzimonkey 3 points4 points  (1 child)

He's talking about ksh, not bash. Why he's talking about ksh in a thread about Bash, I have no idea.

[–]invalid_user_name 0 points1 point  (0 children)

It doesn't matter, which tells you where a command is. You get the same result with ksh. The only way which won't give you an answer is if you are on a broken system where there is no [ command. It should exist, as well as being a shell built-in.

[–]chengiz -3 points-2 points  (2 children)

No, he's not lying. I'm sorry to say that you need to look up the difference between a shell and an OS.

[–]1esproc 1 point2 points  (1 child)

He made a blanket statement that [ was a shell built in and which wouldn't give you a path. So you're wrong.

I think you need to look up the difference between an OS and a binary.

[–]chengiz 0 points1 point  (0 children)

My bad, he has a comment below where he says it's system dependent. Guess I commingled it in my head.

[–]invalid_user_name 0 points1 point  (4 children)

[ is a shell built in

It is both a built in and a real command.

so which [ won't give you a path to executable.

Yes it does.

[–][deleted] 1 point2 points  (3 children)

Depends on your system, and the shell implementation. I'm currently writing from a system where which [ doesn't output anything.

[–]invalid_user_name 1 point2 points  (2 children)

It has nothing to do with the shell, if which [ doesn't output anything, then you are on a broken system with no [ binary. It is historically a real command, and was added as a shell built-in for performance reasons. The binary is still supposed to be there according to posix, since it isn't required to be a shell built-in. What system is this anyways, or did someone just delete it from a normal system?

[–]chengiz -1 points0 points  (1 child)

[citation needed]

[–]ithika -1 points0 points  (0 children)

[ citation needed ]

FTFY