1. first introduce the usage of Alias (alias)
Alias LA = 'LS-a' alias B = 'CD... 'and so on
Alias is a good thing. It can save a lot of time when using shell.
2. But one day I found that the if statement cannot be used when executing the shell script, the following error will be reported:
Bash: build/envsetup. sh: line 30: syntax error near unexpected token 'then'
Bash: build/envsetup. sh: line 30: 'If [! "$ T"]; then'
This occurs when I run source setenv during Android 4.2.2 compilation. It is very depressing!
(If there are other exceptions, enter some commands and press the tab key, for example, Apt-Get install XXX)
3. Various searches finally found that the shell script keyword if: alias if = 'ifconfig' appears in the alias file of. bashrc'
4. Summary
The shell should replace "if" with "ifconfig" when interpreting the script. An error is certainly returned. Therefore, when writing the configuration file,
Be sure not to use keywords or syntax errors.
5. Consequences
Previously, Linux mint was reinstalled due to this error, and the error still occurred.
I may not be able to find this error all my life, but some may not.
I am unfortunate and lucky!
6. Last
Appendix: My frequently-used alias
alias ls='ls --color=tty'alias l.='ls -d .* --color=tty'alias la='ls -a'alias ll='ls -l'alias llh='ls -l -h'alias l='ls'alias c='cd'alias mv='mv -i'alias rm='rm -i'alias vi='vim'alias b='cd ..'alias py='python'alias md='mkdir'alias mk='make'alias mkcl='make clean'alias m='man'alias t='top'alias cl='clear'alias sudo='sudo '# alias if='ifconfig' # I hate u!alias ip='ifconfig'alias mo='mount'alias um='umount'alias gcc='gcc -Wall'alias grep='grep --colour=auto'