Reputation: 113
I have got 2 users on my computer
/home/achille and /home/bozo
When logged under achille, I run
source .bashrc
it runs ok; no error message.
I create .bash_aliases, re-do the same command:
and have got the following error message:
bash: .bashrc: line 34: syntax error near unexpected token `then'
bash: .bashrc: line 34: `if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then'
then
mv .bash_aliases bash_aliases
then
source .bashrc
I have got the same error message.
Now I log as bozo and go to its ~ directory and run the same command. Everything run smoothly (there is no error msg).
diff /home/achille/.bashrc /home/bozo/.bashrc
and there are no differences at all.
I re-log as achille and run
source .bashrc
no error message.
as soon as I put a new .bash_aliases
I have got (a new!!) error message:
bash: .bashrc: line 111: syntax error near unexpected token then'
bash: .bashrc: line 111:
if ! shopt -oq posix; then'
.bashrc and .bash_aliases belong to achille achille
Here is the .bash_aliases content:
alias netd='service network-manager stop && ifconfig wlp2s0 down && macchanger -A wlp2s0'
alias netu='ifconfig wlp2s0 up && service network-manager start'
alias if='ifconfig wlp2s0'
alias delc='rm ~/.mozilla/firefox/*.default/*.sqlite && rm ~/.mozilla/firefox/*default/sessionstore.js && rm -r ~/.cache/mozilla/firefox/*.default/*'
Thanx folks.
Upvotes: 0
Views: 410
Reputation: 241848
You aliased if
to ifconfig wlp2s0
, therefore you can't use it in conditionals anymore.
$ alias if=echo
$ if [ 1 == 1 ] ; then echo yes ; else echo no ; fi
bash: syntax error near unexpected token `then'
$ if Hello world
Hello world
Upvotes: 1