Multiple syntax errors with .bashrc
As per https://docs.manjaro.org/how-to-send-a-pull-request-to-manjaro-gitlab-from-github/ I am submitting this issue so I can then potentially submit a PR via Github to fix at least the syntax issues with the stock .bashrc (dot.bashrc).
In no particular order:
The ex() function (L114-L137) uses the same name as the main executable installed by the package "vi". The function itself also has multiple syntax errors that cause it to fail/have unexpected behavior if the path or file name given to the function has a space/spaces in it. Simply calling the function without any arguments (eg. "ex") produces an error message instead of a helpful usage message. There is zero error handling and also another syntax error in the test on line 119.
Note that this function is not accessible under the default zsh shell so you will need to enter the bash shell using '$ bash' or '$ chsh' and then logout/login.
The function name will need to be changed (if it is not removed) so it does not interfere with any other packages ("extract" is used by libextractor).
$ ex
'' cannot be extracted via ex()
$ unset ex; ex
(vi editor opens)
$ file /usr/bin/vi
/usr/bin/vi: symbolic link to ex
$ file /usr/bin/edit
/usr/bin/edit: symbolic link to ex
$ which ex
/usr/bin/ex
$ file /usr/bin/ex
/usr/bin/ex: sticky ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID\\\[sha1\\\]=66d3b82ae6d463dd9e4b8858324340054fe7903d, for GNU/Linux 4.4.0, stripped
$ pacman -F ex
core/vi 1:070224-6 \\\[installed\\\]
usr/bin/ex
$ pacman -Ql vi
vi /usr/
vi /usr/bin/
vi /usr/bin/edit
vi /usr/bin/ex
vi /usr/bin/vedit
vi /usr/bin/vi
vi /usr/bin/view
vi /usr/lib/
vi /usr/lib/ex/
vi /usr/lib/ex/expreserve
vi /usr/lib/ex/exrecover
vi /usr/share/
vi /usr/share/licenses/
vi /usr/share/licenses/vi/
vi /usr/share/licenses/vi/LICENSE
vi /usr/share/man/
vi /usr/share/man/man1/
vi /usr/share/man/man1/edit.1.gz
vi /usr/share/man/man1/ex.1.gz
vi /usr/share/man/man1/vedit.1.gz
vi /usr/share/man/man1/vi.1.gz
vi /usr/share/man/man1/view.1.gz
vi /var/
vi /var/lib/
vi /var/lib/ex/
There are numerous other syntax errors I will summarize with the following (not all of the following require changes to behave as intended):
$ shellcheck -s bash .bashrc
In .bashrc line 10: printf "Color escapes are %s\\\\n" '\\\\e\\\[$\`{value};...;\`${value}m' ^-------------------------^ SC2016 (info): Expressions don't expand in single quotes, use double quotes for that.
In .bashrc line 27: printf " ${seq0}TEXT\\\\e\\\[m" ^----------------^ SC2059 (info): Don't use variables in the printf format string. Use printf '..%s..' "$foo".
In .bashrc line 28: printf " \\\\e\\\[$\`{vals:+\`${vals+$vals;}}1mBOLD\\\\e\\\[m" ^-- SC2059 (info): Don't use variables in the printf format string. Use printf '..%s..' "$foo".
In .bashrc line 34: \\\[ -r /usr/share/bash-completion/bash_completion \\\] && . /usr/share/bash-completion/bash_completion ^-- SC1091 (info): Not following: /usr/share/bash-completion/bash_completion was not specified as input (see shellcheck -x).
In .bashrc line 66: eval $(dircolors -b \\\~/.dir_colors) ^---------------------------^ SC2046 (warning): Quote this to prevent word splitting.
In .bashrc line 68: eval $(dircolors -b /etc/DIR_COLORS) ^-----------------------------^ SC2046 (warning): Quote this to prevent word splitting.
In .bashrc line 119: if \\\[ -f $1 \\\] ; then ^-- SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean: if \\\[ -f "$1" \\\] ; then
In .bashrc line 121: \\\*.tar.bz2) tar xjf $1 ;; ^-- SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean: \\\*.tar.bz2) tar xjf "$1" ;;
In .bashrc line 122: \\\*.tar.gz) tar xzf $1 ;; ^-- SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean: \\\*.tar.gz) tar xzf "$1" ;;
In .bashrc line 123: \\\*.bz2) bunzip2 $1 ;; ^-- SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean: \\\*.bz2) bunzip2 "$1" ;;
In .bashrc line 124: \\\*.rar) unrar x $1 ;; ^-- SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean: \\\*.rar) unrar x "$1" ;;
In .bashrc line 125: \\\*.gz) gunzip $1 ;; ^-- SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean: \\\*.gz) gunzip "$1" ;;
In .bashrc line 126: \\\*.tar) tar xf $1 ;; ^-- SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean: \\\*.tar) tar xf "$1" ;;
In .bashrc line 127: \\\*.tbz2) tar xjf $1 ;; ^-- SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean: \\\*.tbz2) tar xjf "$1" ;;
In .bashrc line 128: \\\*.tgz) tar xzf $1 ;; ^-- SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean: \\\*.tgz) tar xzf "$1" ;;
In .bashrc line 129: \\\*.zip) unzip $1 ;; ^-- SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean: \\\*.zip) unzip "$1" ;;
In .bashrc line 130: \\\*.Z) uncompress $1;; ^-- SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean: \\\*.Z) uncompress "$1";;
In .bashrc line 131: \\\*.7z) 7z x $1 ;; ^-- SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean: \\\*.7z) 7z x "$1" ;;
For more information:
https://www.shellcheck.net/wiki/SC2046 -- Quote this to prevent word splitt...
https://www.shellcheck.net/wiki/SC1091 -- Not following: /usr/share/bash-co...
https://www.shellcheck.net/wiki/SC2016 -- Expressions don't expand in singl...