How genautocomplete works?

What is the problem you are having with rclone?

I'm trying to use "genautocomplete bash", so that i can autocomplete the paths and names of the files and folders, but when i'm giving the above command the message is "open /etc/bash_completion.d/rclone: no such file or directory"

What is your rclone version (output from rclone version)

1.45

Which OS you are using and how many bits (eg Windows 7, 64 bit)

debian-xfce 32bit

Which cloud storage system are you using? (eg Google Drive)

google drive

The command you were trying to run (eg rclone copy /tmp remote:tmp)

rclone genautocomplete bash

A log from the command with the -vv flag (eg output from rclone -vv copy /tmp remote:tmp)

2019/10/24 19:59:09 DEBUG : rclone: Version "v1.45" starting with parameters ["rclone" "genautocomplete" "bash" "-vv"]
2019/10/24 19:59:09 open /etc/bash_completion.d/rclone: no such file or directory

That's because you don't have permissions. You need to run something like that as root:

felix@gemini:~$ rclone genautocomplete bash
2019/10/24 13:05:30 open /etc/bash_completion.d/rclone: permission denied
felix@gemini:~$ ls -al /etc/bash_completion.d/rclone
ls: cannot access '/etc/bash_completion.d/rclone': No such file or directory
felix@gemini:~$ sudo rclone genautocomplete bash
felix@gemini:~$  ls -al /etc/bash_completion.d/rclone
-rw-r--r-- 1 root root 1542949 Oct 24 13:05 /etc/bash_completion.d/rclone
felix@gemini:~$

That version is pretty old as well. You should grab the latest.

The result is the same when i'm logged in as root

2019/10/24 20:11:08 DEBUG : rclone: Version "v1.45" starting with parameters ["rclone" "genautocomplete" "bash" "-vv"]
2019/10/24 20:11:08 open /etc/bash_completion.d/rclone: no such file or directory

I will try to install the latest version.

Does the parent directory exist?

root@gemini:~# ls -al /etc/bash_completion.d
total 1524
drwxr-xr-x   2 root root      38 Oct 24 13:05 .
drwxr-xr-x 107 root root    8192 Oct 22 12:01 ..
-rw-r--r--   1 root root     439 Jan 22  2019 git-prompt
-rw-r--r--   1 root root 1542949 Oct 24 13:05 rclone

No.

root@ratraceoff:~# ls -al /etc/bash*
-rw-r--r-- 1 root root 1994 Απρ 18 2019 /etc/bash.bashrc
-rw-r--r-- 1 root root 45 Φεβ 12 2019 /etc/bash_completion

What version of Debian?

root@gemini:~# lsb_release -a
No LSB modules are available.
Distributor ID:	Debian
Description:	Debian GNU/Linux 10 (buster)
Release:	10
Codename:	buster
root@gemini:~# uname -a
Linux gemini 4.19.0-6-amd64 #1 SMP Debian 4.19.67-2+deb10u1 (2019-09-20) x86_64 GNU/Linux

root@ratraceoff:~# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 10 (buster)
Release: 10
Codename: buster
root@ratraceoff:~# uname -a
Linux ratraceoff 4.19.0-5-686-pae #1 SMP Debian 4.19.37-5+deb10u2 (2019-08-08) i686 GNU/Linux
root@ratraceoff:~#

You can just:

mkdir /etc/bash_completion.d

and re-run the bash autogen.

I'm assuming you have bash-completion installed.

root@gemini:/etc# apt install bash-completion
Reading package lists... Done
Building dependency tree
Reading state information... Done
bash-completion is already the newest version (1:2.8-6).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

root@ratraceoff:~# apt install bash-completion
Ανάγνωση Λιστών Πακέτων... Ολοκληρώθηκε
Κατασκευή Δένδρου Εξαρτήσεων
Ανάγνωση περιγραφής της τρέχουσας κατάσταση... Ολοκληρώθηκε
bash-completion is already the newest version (1:2.8-6).
0 αναβαθμίστηκαν, 0 νέο εγκατεστημένα, 0 θα αφαιρεθούν και 1 δεν αναβαθμίζονται.
root@ratraceoff:~# mkdir /etc/bash_completion.d
root@ratraceoff:~# rclone genautocomplete bash

Thank you for your help. I think i did it because no error message showed up.

Any link or suggestion how can i test it and how can i use it would be appreciated. My goal is to not have to write the complete path of the files (in google drive) i want to use.

What are you trying to do?

You can't autocomplete a cloud remote path as it doesn't know the path until it connects?

So something like rclone ls remotename:directory/another/file or whatnot, you can't auto complete that.

You can autocomplete local paths as that can enumerate out and you can test that.

I thought i could autocomplete a remote path. Thank you for your help.

So I take that back.

If you source in the bash completion, it 100% works.

felix@gemini:~$ . /etc/bash_completion.d/rclone
felix@gemini:~$
felix@gemini:~$
felix@gemini:~$ rclone ls GD:
crypt/  hosts
felix@gemini:~$ rclone ls GD:
crypt/  hosts
felix@gemini:~$ rclone ls GD:
crypt/  hosts
felix@gemini:~$ rclone ls GD:
crypt/  hosts
felix@gemini:~$ rclone ls GD:
crypt/  hosts
felix@gemini:~$ rclone ls GD:crypt/
95tj3q4gj5ban13ppu0kisguco   smu5ej34ujbdoip1cm3mlk92q4/  tnvepu36qiohcun8v84ddhsam0/
felix@gemini:~$ rclone ls GD:crypt/

I didn't realize it will connect and make the call. Learn something new every day!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.