[clug] Fine tuning some last bash niggles

Bill Clarke llib at computer.org
Wed Nov 5 15:48:13 EST 2003

Michael.James at csiro.au wrote, On 05/11/03 15:19:
> Bash still doesn't have a good "which" function.
> Under tcsh, which gives a complete answer.
> eg: Why does rm infuriatingly ask if I really mean it?
> tcsh> which rm
> aliased to "rm -i"			# AHAH!
> tcsh> unalias rm
> Bash's "which" maintains a guilty silence.
> Or:
> bash> ln -s real-dir  soft-link-to-dir
> bash> cd soft-link-to-dir
> bash> pwd
> ~/soft-link-to-dir
> 		# what! That's how I got here, not where I am
> bash> which pwd
> bash>				# more guilty silence, so try this
> bash> /bin/pwd
> ~/real-dir/
> So bash has not only subverted pwd
>  with its own broken version
>  but it won't tell you this has happened.
> And it still doesn't have "where" at all.
> "where" used to continue down the path
>  reporting all the hits for a given command.
> The first listed will be what happens
>  if you type the raw (pathless) command,
>  the other possibilities follow in order.
> It was useful.

try "type -all".

bash> type -all pwd
pwd is a shell builtin
pwd is /bin/pwd

as for the relative pwd, that's configurable, but i cannot remember how
to change.  possibly POSIXLY_CORRECT.
aha: from the info pages on bash, use `pwd -P'.

/lib BillClarke PostdoctoralFellow CompSci ANU cs.anu.edu.au/CC-NUMA
http://llib.cjb.net llib at computer.org  tel:+61-2-6125x5687 fax:x0010
PGPid:B381EE7DB7D3E58F17248C672E2DA124ADADF444 GNU unix LaTeX XPilot
Buffy DrWho Goodies StarTrek XFiles Origami SML SMP MPI mozilla tcsh
Asimov Bear Clarke Donaldson Volleyball Ultimate Cricket emacs C++ X
Jordan Kay Lackey Martin Stasheff DeepPurple H&C KLF Queen PinkFloyd

More information about the linux mailing list