In a bash shell, why can't I create an alias
$ alias fooo="echo bac"
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep='grep --color=auto'
alias l='ls -CF'
alias la='ls -A'
alias ll='ls -alF'
alias ls='ls --color=auto'
$ alias fooo='echo bac'
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep='grep --color=auto'
alias l='ls -CF'
alias la='ls -A'
alias ll='ls -alF'
alias ls='ls --color=auto'
$ fooo
fooo: command not found
$ alias fooo
bash: alias: fooo: not found
In another bash shell, the above commands succeed in creating an alias
$ alias fooo="echo bac"
$ fooo
bac
In the first shell, if I start a new shell (just type bash and press enter), or start a new login shell (type bash -l), the above commands also succeed as in the second shell.
Regarding the reply on alias command in the first shell
$ which alias
$ whereis alias
alias:
$ builtin alias fooo="echo bac"
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep='grep --color=auto'
alias l='ls -CF'
alias la='ls -A'
alias ll='ls -alF'
alias ls='ls --color=auto'
$ type alias
alias is a shell builtin
$ type -a alias
alias is a shell builtin
$ unalias alias
bash: unalias: alias: not found
Regarding the comment on echo in the first shell
$ echo hello
hello
$ whereis echo
echo: /bin/echo /usr/share/man/man1/echo.1.gz
$ which echo
/bin/echo