[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Need commands



On Sun, 14 Jun 2020, mick crane wrote:

On 2020-06-14 12:42, tomas@tuxteam.de wrote:
On Sun, Jun 14, 2020 at 12:23:15PM +0100, mick crane wrote:
On 2020-06-13 19:51, Darac Marjal wrote:
...
>The full list of commands depends on what's installed, but you can
>retrieve that list by opening a terminal and typing:
>
>    compgen -ac

what are these words that begin with the underscore ?

__load_completion
__ltrim_colon_completions
__parse_options
__reassemble_comp_words_by_ref
_allowed_groups
_allowed_users
_available_interfaces
_cd
_cd_devices
_command

I don't have those. Most probably they are shell functions defined for your
session. Just issue the command

  type __load_completion

to shed light on that.

Which package or program defines them is anyone's guess, but you can try
to look into your shell initialization files (i.e. /etc/profile, ~/.bashrc,
all those mentioned in the FILES section of man bash [1]) to learn more.

Cheers

[1] or whatever shell is yours.

-- tomás

I wish I'd never looked now.
so they are functions defined in the actual bash code for other words to get the result of ?

Er, they look like shell functions that bash_completion (from package
"bash-completion") defines for the greater glory of Bash
Completionstan.

 $ apt-description bash-completion # Not a real command
 bash-completion - programmable completion for the bash shell
  bash completion extends bash's standard completion behavior to achieve
  complex command lines with just a few keystrokes.  This project was
  conceived to produce programmable completion routines for the most
  common Linux/UNIX commands, reducing the amount of typing sysadmins
  and programmers need to do on a daily basis.
 Homepage: https://github.com/scop/bash-completion

You can read about shell functions in general in the bash man page,
either briefly under section "SHELL GRAMMAR" in subsection "Shell
Function Definitions", or at greater length in the section
"FUNCTIONS".

I hear some people find bash-completion helpful. Personally, though,
no. Do not want.

So, when using a system with bash-completion installed, I disable it
in my own accounts with two steps:

STEP 1

Create a file ~/.config/bash_completion containing the line "shopt -u
progcomp". (If you happen not to have a directory ~/.config already,
create one first.)

 $ echo "# Disable bash-completion" >> ~/.config/bash_completion
 $ echo "shopt -u progcomp" >> ~/.config/bash_completion

This makes /etc/profile.d/bash_completion.sh do nothing when it runs
(other than source your ~/.config/bash_completion), because
/etc/profile.d/bash_completion.sh is polite like that.

In order for this to be effective, the file you create in ~/.config
must have that precise name (with an underscore, not a hyphen), and it
must unset the progcomp shell option (which is what the line "shopt -u
progcomp" does).

/usr/share/doc/bash-completion/README.md.gz explains STEP 1 more
generally like so:

  The `profile.d` script provides a configuration file hook that can
  be used to prevent loading `bash_completion` on per user basis when
  it's installed system wide. To do this:

  1. Turn off programmable completion with `shopt -u progcomp` in
     `$XDG_CONFIG_HOME/bash_completion` (or
     `~/.config/bash_completion` if `$XDG_CONFIG_HOME` is not set)

  2. Turn it back on (for example in `~/.bashrc`) if you want to use
     programmable completion for other purposes.


STEP 2

Examine ~/.bashrc and look for any sections that enable
bash_completion, and comment them out:

# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
# if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
#    . /etc/bash_completion

Both steps are required. The first keeps system-wide profile from
running bash_completion for you. The second keeps your ~/.bashrc from
running it for yourself.

After doing both, start a new bash session and check to see if

 $ typeset -F

still shows presence of the offending functions.

--
https://news.ycombinator.com/item?id=12518471 alexk already addressed
your concern: your keys, preferably issued by your org's CA (instead
of being generated by you) should be short-lived, oftentimes for the
duration of your "work shift". The tools listed above support this.

Reply to: