Why is this?
When I do this
It doesn't take me to the Desktop. But this:
echo "foo bar" | GREP bar
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
From your other questions I take it you're using OS X. The default HFS+ filesystem on OS X is case-insensitive: you can't have two files called "abc" and "ABC" in the same directory, and trying to access either name will get to the same file. The same thing can happen under Cygwin, or with case-insensitive filesystems (like FAT32 or ciopfs) anywhere.
grep is a real executable, it's looked up on the filesystem (in the directories of
PATH). When your shell looks in
/usr/bin for either
GREP it will find the
Shell builtins are not looked up on the filesystem: because they're built in, they are accessed through (case-sensitive) string comparisons inside the shell itself.
What you're encountering is an interesting case. While
cd is a builtin, accessed case-sensitively,
CD is found as an executable
cd executable is pretty useless: because
cd affects the current shell execution environment, it is always provided as a shell regular built-in, but there is a
cd executable for POSIX's sake anyway, which changes directory for itself and then immediately terminates, leaving the surrounding shell where it started.
You can try these out with the
$ type cd cd is a shell builtin $ type CD CD is /usr/bin/CD
type tells you what the shell will do when you run that command. When you run
cd you access the builtin, but
CD finds the executable. For other builtins, the builtin and the executable will be reasonably compatible (try
echo), but for
cd that isn't possible.