This is going to be very hard to explain over email. I tried to use script
from util-linux in GNU bash v.5.1.16 on Ubuntu 22.04, but that doesn't seem
to offer any help.
Here's a tree to show the directory structure and let's say I want to move
the Hofstadter book to /dev/shm/cache. I'll try tab completion after
entering ` "Hofs `
$ tree /library/books/audiobooks/Hof*
/library/books/audiobooks/Hoffman,\ Donald
`-- The\ Case\ Against\ Reality:\ Why\ Evolution\ Hid\ the\ Truth\ from\
Our\ Eyes\ (2019)
|-- The\ Case\ Against\ Reality\ --\ Cover.jpg
|-- The\ Case\ Against\ Reality\ --\ Part\ 01.opus
|-- The\ Case\ Against\ Reality\ --\ Part\ 02.opus
|-- The\ Case\ Against\ Reality\ --\ Part\ 03.opus
|-- The\ Case\ Against\ Reality\ --\ Part\ 04.opus
|-- The\ Case\ Against\ Reality\ --\ Part\ 05.opus
|-- The\ Case\ Against\ Reality\ --\ Part\ 06.opus
|-- The\ Case\ Against\ Reality\ --\ Part\ 07.opus
|-- The\ Case\ Against\ Reality\ --\ Part\ 08.opus
|-- The\ Case\ Against\ Reality\ --\ Part\ 09.opus
|-- The\ Case\ Against\ Reality\ --\ Part\ 10.opus
|-- The\ Case\ Against\ Reality\ --\ Part\ 11.opus
|-- The\ Case\ Against\ Reality\ --\ Part\ 12.opus
|-- The\ Case\ Against\ Reality\ --\ Summary.nfo
`-- metadata.json
/library/books/audiobooks/Hofstadter,\ Richard
`-- Anti-Intellectualism\ in\ American\ Life\ (1963)
|-- Anti-Intellectualism\ in\ American\ Life\ --\ Cover.jpg
|-- Anti-Intellectualism\ in\ American\ Life\ --\ Part\ 01.opus
|-- Anti-Intellectualism\ in\ American\ Life\ --\ Part\ 02.opus
|-- Anti-Intellectualism\ in\ American\ Life\ --\ Part\ 03.opus
|-- Anti-Intellectualism\ in\ American\ Life\ --\ Part\ 04.opus
|-- Anti-Intellectualism\ in\ American\ Life\ --\ Part\ 05.opus
|-- Anti-Intellectualism\ in\ American\ Life\ --\ Part\ 06.opus
|-- Anti-Intellectualism\ in\ American\ Life\ --\ Part\ 07.opus
|-- Anti-Intellectualism\ in\ American\ Life\ --\ Part\ 08.opus
|-- Anti-Intellectualism\ in\ American\ Life\ --\ Part\ 09.opus
|-- Anti-Intellectualism\ in\ American\ Life\ --\ Part\ 10.opus
|-- Anti-Intellectualism\ in\ American\ Life\ --\ Part\ 11.opus
|-- Anti-Intellectualism\ in\ American\ Life\ --\ Part\ 12.opus
|-- Anti-Intellectualism\ in\ American\ Life\ --\ Part\ 13.opus
|-- Anti-Intellectualism\ in\ American\ Life\ --\ Part\ 14.opus
|-- Anti-Intellectualism\ in\ American\ Life\ --\ Part\ 15.opus
|-- Anti-Intellectualism\ in\ American\ Life\ --\ Part\ 16.opus
|-- Anti-Intellectualism\ in\ American\ Life\ --\ Summary.nfo
|-- cover.jpg
`-- metadata.json
1 directory, 20 files
To start with, I begin entering the command followed by ` "Hofs ` and a tab:
/library/books/audiobooks $ mv "Hofs<Tab>
This results in the following being completed:
/library/books/audiobooks $ mv "Hofstadter, Richard"/
If I then try to get tab completion of the subdirectory, i.e., by opening a
double quote and starting to type Anti followed by tab, the result here is
the issue.
start with: /library/books/audiobooks $ mv "Hofstadter, Richard"/
enter: "Anti<tab>
the result is
$ mv "Hofstadter, Richard"/"Hofstadter, Richard/Anti-Intellectualism in
American Life (1963)"/
What I expect is:
$ mv "Hofstadter, Richard"/"Anti-Intellectualism in American Life (1963)"/
OR
$ mv "Hofstadter, Richard/Anti-Intellectualism in American Life (1963)"/
but not to have the wrong parent directory left on the entry line.
If there's a better way to demonstrate what's going on, please let me know.
this is on Ubuntu 22.04.
This has always failed any time I can remember trying it with Ubuntu/bash.
On Mon, Sep 25, 2023 at 9:12 AM Chet Ramey <[email protected]> wrote:
> On 9/22/23 5:58 PM, Brian Vargo wrote:
>
> > $ mv Bu<TAB> ---> $ mv Buehrer\,\ Ted/How\ to\ Listen\ to\ and\
> > Appreciate\ Jazz\ \[TMS\]\ \(2006\)/ "Bu<TAB> ----> $ mv Buehrer\,\
> > Ted/How\ to\ Listen\ to\ and\ Appreciate\ Jazz\ \[TMS\]\ \(2006\)/
> > "Buehrer, Ted"/<TAB> -----> $ mv Buehrer\,\ Ted/How\ to\ Listen\ to\
> and\
> > Appreciate\ Jazz\ \[TMS\]\ \(2006\)/ "Buehrer, Ted"/"Buehrer, Ted/How to
> > Listen to and Appreciate Jazz [TMS] (2006)"/
>
> I can't reproduce this. I'm testing with bash-5.2.
>
> I get, broken into different lines for clarity:
>
> $ mv Buehrer\,\ Ted/ [after the first tab]
>
> $ mv Buehrer\,\ Ted/How\ to\ Listen\ to\ and\ Appreciate\ Jazz\ \[TMS\]\
> \(2006\)/ [after the second tab]
>
> (Note that default completion stops at directory boundaries; I'm not sure
> how you got multiple directory names completed with a single tab.)
>
> Then you add the space and start a new double-quoted argument:
>
> $ mv Buehrer\,\ Ted/How\ to\ Listen\ to\ and\ Appreciate\ Jazz\ \[TMS\]\
> \(2006\)/ "Buehrer, Ted"/ [after the third tab]
>
> $ mv Buehrer\,\ Ted/How\ to\ Listen\ to\ and\ Appreciate\ Jazz\ \[TMS\]\
> \(2006\)/ Buehrer\,\ Ted/How\ to\ Listen\ to\ and\ Appreciate\ Jazz\
> \[TMS\]\ \(2006\)/ [after the fourth tab]
>
> Note that bash/readline default completion requotes the entire pathname
> once there is another directory name requiring quoting.
>
> Now, this command will obviously fail because you're trying to move a
> directory name to itself.
>
>
>
> > Expected:
> > For the last tab completion, I expect $ mv Buehrer\,\ Ted/How\ to\
> Listen\
> > to\ and\ Appreciate\ Jazz\ \[TMS\]\ \(2006\)/ "Buehrer, Ted"/"How to
> Listen
> > to and Appreciate Jazz [TMS] (2006)"/
> > and then for it to change into that directory.
>
> Quoting differences aside, these are identical directory names, so the
> `mv'is going to fail regardless. But why would you expect bash or another
> application to change to that directory?
>
> --
> ``The lyf so short, the craft so long to lerne.'' - Chaucer
> ``Ars longa, vita brevis'' - Hippocrates
> Chet Ramey, UTech, CWRU [email protected] http://tiswww.cwru.edu/~chet/
>
>