The Cookie Machine - Click here to drag window

DUMMY TEXT - Real text set in assets/js/theCookieMachine.js

If you can read me, I'm broken!

Views: 9,619β€…    Votes:  4β€…
Tags: command-line   bash  
Link: πŸ” See Original Answer on Ask Ubuntu ⧉ πŸ”—

URL: https://askubuntu.com/q/1047427
Title: source command error from /usr/share/bash-completion/bash-completion when I open a terminal
ID: /2018/06/17/source-command-error-from-_usr_share_bash-completion_bash-completion-when-I-open-a-terminal
Created: June 17, 2018    Edited:  September 4, 2023
Upload: September 15, 2024    Layout:  post
TOC: false    Navigation:  false    Copy to clipboard:  false


To see if any of your aliases are conflicting with a bash built-in or a system command use this script:

#!/bin/bash -i

# NAME: alias-check
# PATH: /mnt/e/bin
# DESC: Verify alias doesn't conflict with bash built-in
# DATE: June 17, 2018.

# Get aliases
alias > /tmp/alias.lst
sed -i 's/=.*//; s/alias //g' /tmp/alias.lst
#cat /tmp/alias.lst
while read -r line 
do 
   command type -a ${line}
done< /tmp/alias.lst

Testing bad aliases

Edit ~/.bashrc and insert these β€œbad” aliases:

alias fi=find
alias test='ls test'

Now run the script alias-check:

bash: /home/rick/.bashrc: line 171: syntax error: unexpected end of file
alert is aliased to `notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e 's/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//')"'
cdh is aliased to `cd /home/rick'
cdo is aliased to `cd /mnt/old'
cdt is aliased to `cd /usr/share/grub/themes/Tuxkiller2'

egrep is aliased to `egrep --color=auto'
egrep is /bin/egrep
fgrep is aliased to `fgrep --color=auto'
fgrep is /bin/fgrep
fi is aliased to `find'
fi is a shell keyword
grep is aliased to `grep --color=auto'
grep is /bin/grep
l is aliased to `ls -CF'
la is aliased to `ls -A'
ll is aliased to `ls -alF'
ls is aliased to `ls --color=auto'
ls is /bin/ls
lsdrv is aliased to `lsblk -o NAME,FSTYPE,LABEL,MOUNTPOINT,SIZE,MODEL'
redalert is aliased to `notify-send --urgency=critical -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e 's/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//')"'
sudo is aliased to `sudo '
sudo is /usr/bin/sudo
test is aliased to `ls test'
test is a shell builtin
test is /usr/bin/test
zenity is aliased to `zenity 2>/dev/null'
zenity is /mnt/e/usr/local/bin/zenity
zenity is /usr/local/bin/zenity
zenity is /usr/bin/zenity

Notice the lines:

Look for these types of errors in your aliases.

After testing don’t forget to remove the aliases fi and test and save ~/.bashrc again.

You can’t run the test by simply issuing alias at the command line because the first line of the script #!/bin/bash -i loads a new shell using ~/.bashrc.

⇧ Setting to High Performance Why should users never use normal sudo to start graphical applications?  β‡©