home | list info | list archive | date index | thread index

Re: [OCLUG-Tech] path completion query

I really never imagined my "lazy keyboard habits" would lead to all this discovery.

Thanks.

JN

On 2018-04-06 06:07 AM, Brett Delmage wrote:
> On Thu, 5 Apr 2018, Dianne Skoll wrote:
> 
>> On Thu, 5 Apr 2018 10:16:29 -0400
>> J C Nash <profjcnash [ at ] gmail [ dot ] com> wrote:
>>
>>> And. ... tab on first couple of letters of symlinked directory gives
>>> no /, but hitting tab again gives the /. Went back to my local bash
>>> and same behaviour.
>>
>> That's a smart way to work.  Sometimes you want the slash and sometimes
>> not.
>>
>> cd symlink/  # want the slash
>> rm symlink   # don't want the slash - rm symlink/ will fail
>>
>> Clever bash! :)
> 
> So I thought I had a vague idea of how command completion works (i.e. 'some scripts in an /etc directory somewhere that
> I saw years ago' :-)
> 
> This discussion prompted me to look it up... and I got waay deeper than I planned, again ;-)
> 
> Reading this article about 'under the hood'
> 
> https://spin.atomicobject.com/2016/02/14/bash-programmable-completion/
> (part 2)
> 
> way down, I discovered more about readline. And buried in that, a config option related to symlinks
> 
> set mark-symlinked-directories off  (aha!)
> 
> which is described in the bash man page, around line 1758 (you have to love docs that are this extensive...):
> 
>   mark-symlinked-directories (Off)
> If set to On, completed names which are symbolic links to directories have a slash appended (subject to the value of
> mark-directories).
> 
> So it looks like this symlink behavior can vary by distro -- but is easily configurable with a line in inputrc.
> 
> Who knew. I discovered lots more about readline config I never new before. I really enjoy the questions on this list
> because I often learn something new.
> 
> -- 
> Congratulations and thanks to the new OCLUG directors!
> 
> Brett
> 
> 
> 
> _______________________________________________
> Linux mailing list
> Linux [ at ] lists [ dot ] oclug [ dot ] on [ dot ] ca
> http://oclug.on.ca/mailman/listinfo/linux