Tuesday, December 31, 2013

Re: Where is my system-wide init file?

On 31/12/13 09:34, Erik Christiansen wrote:
> On 30.12.13 08:32, Gary Johnson wrote:
>> On 2013-12-30, Tony Mechelynck wrote:
>>> On 29/12/13 21:15, Elena Garrulo wrote:
>>
>>>> Thank you for making me learn the "type" command. Cool! :-)
>>>
>>> There is also "which" which is a separate program (and thus works for
>>> all shells) but it doesn't know about shell aliases.
>>
>> The which(1) v2.20 man page recommends using a shell function
>> wrapper around which that finds aliases and functions as well.
>
> Remarkable how much good sense can be found in manpages. For the last
> quarter century or more, I've had (on every machine I touch¹):
>
> $ grep which .bashrc
> alias which='type -a' # Checks aliases & functions also.

The problem with this alias, IIUC, is when one tries to use

vim `which somecommand`

to edit an executable script, since the output of "type" is in a
different format. I suppose you would have to do

vim `/usr/bin/which somecommand`

instead (at least on my system, which is in /usr/bin, not in plain /bin)
to bypass the alias, or else do it manually:

which somecommand # aliased to type -a
vim ~/bin/somecommand

>
> (Never could understand why I should ask the shell to type thingy,
> then expect it to answer with which thingy it'd use, instead.)
>
> Alas, the 2009 Debian manpage in my Ubuntu distro lacks the wisdom
> you've found.
>
> Erik
>
> ¹ First HP-UX, then Solaris, now linux - all had "type" AFAIR.
>

Best regards,
Tony.
--
hundred-and-one symptoms of being an internet addict:
60. As your car crashes through the guardrail on a mountain road, your first
instinct is to search for the "back" button.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: