Sunday, April 28, 2024
 Popular · Latest · Hot · Upcoming
4
rated 0 times [  4] [ 0]  / answers: 1 / hits: 10195  / 2 Years ago, sun, july 24, 2022, 7:13:49

When one issues the set command without arguments at a bash prompt (which should output a list of shell variables and their values), a script of 8,274 lines scrolls by. Examining this script shows that it is instructions to the shell for executing commands - and it seems that it runs python scripts, making it essentially a kludge of monstrous proportions. I've seen other builtins behave in a few ways



No output:



Me:~$ wait
Me:~$ true
Me:~$ test


An error, with no usage hint:



Me:~$ select
bash: syntax error near unexpected token `newline'


An error, with usage hint:



Me:~$ source
bash: source: filename argument required
source: usage: source filename [arguments]
Me:~$ return
bash: return: can only `return' from a function or sourced script


I'm having trouble understanding why set behaves in this way. It seems undocumented, and I wasn't really expecting it. I'm troubled as to why this happens. Can anyone explain?


More From » bash

 Answers
0

Those 8k lines are mainly completion functions from the bash-completion package. On my old desktop, bash uses almost a second to read through and define all those functions, most of which I never use, so I disable it.



To disable it, edit your ~/.bashrc, locate these three lines near the end, and prepend a # to each of the lines.



if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
. /etc/bash_completion
fi


Next time you run an interactive bash session, set will only output about 50-100 lines; mostly environment variables and special shell variables.


[#40275] Monday, July 25, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
errettas

Total Points: 160
Total Questions: 118
Total Answers: 91

Location: Laos
Member since Fri, Sep 11, 2020
4 Years ago
;