Lowry76 has asked for the wisdom of the Perl Monks concerning the following question:

Hi monks,

I have to appologize that I'm posting a non-perl question. But I don't know whom else to ask and it is kind of perl related for me.
Problem: When I'm calling a perl script with "perl someperl.pl -d path1 -o path2 ..." on some computers I can't use tab-completion for certain parameters. For example, on my work laptop the "-d" parameter disables bash tab-completion. I guess there is a bash config file of some sort that defines those parameters. Can somehone give me a hint what to search for?

Lowry
  • Comment on Tab-completion ... not perl related though

Replies are listed 'Best First'.
Re: Tab-completion ... not perl related though
by Anonymous Monk on Sep 28, 2014 at 23:39 UTC

    The official info is in the Bash Manual, http://www.gnu.org/software/bash/manual/bashref.html#Programmable-Completion . A lot of distros come with a large collection of completion scripts, but where those are located depends a bit on the distro. For example, on my system it's /etc/bash_completion.d . If your system is different, check your ~/.bashrc, that usually calls some scripts in /etc, of which one will hopefully handle completion. Without digging into the completion script for Perl, it might be possible for you to just copy over the script from a "working" computer to one where it doesn't work - provided it's compatible with whatever version of bash is running there.

      I checked the .bashrc but couldn't find anything. Guess I'll have to screen the man then ... :)
      Thanks for the hint.

        At least on my system, I checked man bash, which referred me to the system-wide bashrc at /etc/bash.bashrc . Perhaps your system-wide bashrc handles completion, instead of the one in your homedir.

Re: Tab-completion ... not perl related though
by Don Coyote (Hermit) on Sep 29, 2014 at 10:35 UTC

    Hello Lowry76

    For example, on my work laptop the "-d" parameter disables bash tab-completion.

    Some technical tests to consider before ploughing into Bash source code.

    Simply use the existing tab completion to complete the paths first than backtrack over the command line and enter the switches afterwards.

    I have not experienced a switch controlling command line editing behaviour, at least not without a ctrl character input. Most times I CTRL+S to save, but on CLI scroll lock is set (for me).

    Are you using absolute paths, or relative paths ? if the file is in the cwd prepend a ./
    For example,
    ./fileinthisdir
    /home/usr/absolutepathto/fileinthisdir

    Are you using bash? ls -l /bin/sh should inform you of your shell, you may be surprised.

    quick-tapping tab usually gives you info or completion selections.

    Once you are sure about those then it may be time to go to another level.

    DoC

    Scroll Locks!
Re: Tab-completion ... not perl related though
by choroba (Cardinal) on Sep 29, 2014 at 10:46 UTC
    Can you still use the path completion? Instead of TAB, try pressing Alt + /.
    لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ
Re: Tab-completion ... not perl related though
by shmem (Chancellor) on Sep 29, 2014 at 21:31 UTC

    On debian (derived) systems, the bash completion scripts are bundled in the package bash-completion:

    qwurx [shmem] ~ > dpkg -l bash\* Desired=Unknown/Install/Remove/Purge/Hold | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/T +rig-pend |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad) ||/ Name Version Architecture Descripti +on +++-======================-================-================-========= +======================================== ii bash 4.2-5ubuntu3 amd64 GNU Bourn +e Again SHell ii bash-completion 1:2.0-1ubuntu3 all programma +ble completion for the bash shell un bash-doc <none> (no descr +iption available)

    Don't know how that is handled on systems with the RPM package manager (RedHat, Fedora, SuSE, CentOS etc.).

    You could grab the debian package, make a temporary directory and unpack the package file there with

    ar x ~/Downloads/bash-completion_2.0-1_all.deb

    You will find a data.tar.gz which contains the files, unpacking that (tar xfz data.tar.gz) you will find the directories etc/ and usr/. Reolcate their content to the system root. The sourcing code for the completion files is in /etc/bash.bashrc as follows:

    # enable bash completion in interactive shells if [ -f /etc/bash_completion ] && ! shopt -oq posix; then . /etc/bash_completion fi

    I guess that on non-debian systems the setup is similar.

    perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'