Switched to Bash and Comparison of Shells

Dan Nelson dnelson at allantgroup.com
Thu Jun 10 17:57:13 UTC 2010


In the last episode (Jun 10), Lowell Gilbert said:
> Dan D Niles <dan at more.net> writes:
> 
> > The which command functions differently between bash and tcsh.  For
> > example, I have ls aliased to do color output and add some other options
> > that I like.  With tcsh, 'which ls' returns 
> > "ls: 	 aliased to \ls -GFB"; with bash it returns 
> > "/bin/ls".  The tcsh behavior tells you what will be executed when you
> > run ls.  The bash behavior can be achieved in tcsh with 'which \ls', so
> > I think I like the tcsh behavior better.  I could probably write a
> > function in bash that emulates tcsh's builtin which command.
> 
> bash (like most other sh-style shells) has no "which" builtin.  You end up
> running /usr/bin/which.  bash (like most other sh-style shells) does have
> a (rough) equivalent, which is "type".

zsh's which command will prints the output of aliases, and a very
comprehensive completion system, too.  It also supports more csh
features/syntax than bash (good for people used to csh/tcsh).

(dan at dan.13) /home/dan> which ls
ls: aliased to ls -Fa

-- 
	Dan Nelson
	dnelson at allantgroup.com


More information about the freebsd-questions mailing list