My tab completion (BASH
in debian
) shows me different numbers for combining two commands subsequently. It's somehow common sense that I can execute more commands the more privileges I have, e. g. with sudo
.
Obviously, the ways for concatenating with ;
and &&
are slightly different.
- What's the difference between them?
- Why does the difference in numbers decrease for accessible commands for users with
root
privileges? I would expect an increasing number (difference). (most probable/most common reason)
nepumuk@nepumuk:~$
Display all 2216 possibilities? (y or n)
nepumuk@nepumuk:~$ date ;
Display all 2214 possibilities? (y or n)
nepumuk@nepumuk:~$ date &&
Display all 2216 possibilities? (y or n)
nepumuk@nepumuk:~$ date ; sudo
Display all 2729 possibilities? (y or n)
nepumuk@nepumuk:~$ date && sudo
Display all 2730 possibilities? (y or n)
nepumuk@nepumuk:~$ date ; man
Display all 8127 possibilities? (y or n)
nepumuk@nepumuk:~$ date && man
Display all 8127 possibilities? (y or n)
EDIT 1: I also noticed that the "number of possibilities" increases by one or two when I do this enquiry and start it all over again (except for the amount of manuals, which is somehow forseeable)…
So I did it some times for encountering a reproducible behaviour:
nepumuk@nepumuk:~$
Display all 2221 possibilities? (y or n)
nepumuk@nepumuk:~$ date ;
Display all 2221 possibilities? (y or n)
nepumuk@nepumuk:~$ date &&
Display all 2221 possibilities? (y or n)
nepumuk@nepumuk:~$ date ; sudo
Display all 2735 possibilities? (y or n)
nepumuk@nepumuk:~$ date && sudo
Display all 2735 possibilities? (y or n)
EDIT 2: I even can't run some commands with sudo
"enabled":
nepumuk@nepumuk:~$ sudo alias
sudo: alias: command not found
So the number (more exact: the set) of commands does differ whether sudo
is used.
shopt progcomp
), bash will try to complete not only commands, but also command line switches (and guess --most of the time wrong ;-) -- when some commands and filenames cannot be used).shopt progcomp
. Maybe it's a default option…?shopt progcomp
will tell you if it's enabled or not. It's enabled by default on eg. debian.shopt progcomp
-- it will answer withprogcomp on
orprogcomp off
. You can useshopt -s progcomp
to enable it, andshopt -u progcomp
to disable it.