Re: [OCLUG-Tech] path completion query
On Fri, 6 Apr 2018, J C Nash wrote: I really never imagined my "lazy keyboard habits" would lead to all this discovery. "The reasonable man adapts himself to the conditions that surround him... The unreasonable man adapts surrounding conditions to himself... All progress depends on the unreasonable man." -- George Bernard Shaw ___ Linux mailing list Linux@lists.oclug.on.ca http://oclug.on.ca/mailman/listinfo/linux
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 Nashwrote: >> >>> 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@lists.oclug.on.ca > http://oclug.on.ca/mailman/listinfo/linux ___ Linux mailing list Linux@lists.oclug.on.ca http://oclug.on.ca/mailman/listinfo/linux
Re: [OCLUG-Tech] path completion query
On Thu, 5 Apr 2018, Dianne Skoll wrote: On Thu, 5 Apr 2018 10:16:29 -0400 J C Nashwrote: 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@lists.oclug.on.ca http://oclug.on.ca/mailman/listinfo/linux
Re: [OCLUG-Tech] path completion query
On Thu, 5 Apr 2018 10:16:29 -0400 J C Nashwrote: > 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! :) Regards, Dianne. ___ Linux mailing list Linux@lists.oclug.on.ca http://oclug.on.ca/mailman/listinfo/linux
Re: [OCLUG-Tech] path completion query
Hmm. I downloaded latest source (my Linux Mint uses 4.3.48(1)) and built it. Tried it. 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. Maybe this is intentional, and knowing the double tab does the job is fine for my uses. Thanks. Off-topic: Dianne. Did you send a proxy for AGM tonight? (Or plan to be there?) Others: Please send proxies to me or Scott or someone going. We don't want to end up without quorum. There are about 170 names on our list, and we need 20 for quorum. Best, JN On 2018-04-05 09:25 AM, Dianne Skoll wrote: > On Thu, 5 Apr 2018 09:17:21 -0400 > J C Nashwrote: > >> When I am in a terminal and want to cd to the appropriate folder >> I typically type just the first couple of characters then hit tab. >> I've noticed that regular directories add the /, but command >> completion for the symlinks leaves it off. > > What shell are you using? Under Bash version 4.4 on Debian Stretch, > I get the / when I hit Tab. > >> I'm assuming that is because the symlink does not have the d flag >> available. > > Symlinks under Linux don't have any flags or permissions associated with > them. Their permissions always show up as 0777. The actual permissions > and flags are controlled by the pointed-to file. > > Regards, > > Dianne. > ___ > Linux mailing list > Linux@lists.oclug.on.ca > http://oclug.on.ca/mailman/listinfo/linux > ___ Linux mailing list Linux@lists.oclug.on.ca http://oclug.on.ca/mailman/listinfo/linux
Re: [OCLUG-Tech] path completion query
On Thu, 5 Apr 2018 09:17:21 -0400 J C Nashwrote: > When I am in a terminal and want to cd to the appropriate folder > I typically type just the first couple of characters then hit tab. > I've noticed that regular directories add the /, but command > completion for the symlinks leaves it off. What shell are you using? Under Bash version 4.4 on Debian Stretch, I get the / when I hit Tab. > I'm assuming that is because the symlink does not have the d flag > available. Symlinks under Linux don't have any flags or permissions associated with them. Their permissions always show up as 0777. The actual permissions and flags are controlled by the pointed-to file. Regards, Dianne. ___ Linux mailing list Linux@lists.oclug.on.ca http://oclug.on.ca/mailman/listinfo/linux