0

I'm trying to install aliases in .bash_aliases, but when I restart the terminal, I got that at the beginning :

bash: alias: venva: not found
bash: alias: =: not found
bash: alias: source venv/bin/activate: not found
bash: alias: django: not found
bash: alias: =: not found
bash: alias: python manage.py: not found
bash: alias: makemigrations: not found
bash: alias: =: not found
bash: alias: python manage.py makemigrations: not found
bash: alias: migrate: not found
bash: alias: =: not found
bash: alias: python manage.py migrate: not found
bash: alias: C24: not found
bash: alias: =: not found
bash: alias: cd Projects/credit-24-django/: not found

.bashrc file :

#If not running interactively, don't do anything

case $- in
    *i*) ;;
    *) return;;
esac

# don't put duplicate lines or lines starting with space in the history.
HISTCONTROL=ignoreboth

# Add to history instead of overriding it
shopt -s histappend

# History lenght
HISTSIZE=1000
HISTFILESIZE=2000

# Window size sanity check
shopt -s checkwinsize

# User/root variables definition
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
    debian_chroot=$(cat /etc/debian_chroot)
fi

# Colored XTERM promp
case "$TERM" in
    xterm-color) color_prompt=yes;;
esac

# Colored prompt
force_color_prompt=yes

if [ -n "$force_color_prompt" ]; then
    if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
        color_prompt=yes
    else
        color_prompt=
    fi
fi

# Prompt
if [ -n "$SSH_CONNECTION" ]; then
    export PS1="\[$(tput setaf 1)\]┌─╼ \[$(tput setaf 7)\][\w]\n\[$(tput setaf 1)\]\$(if [[ \$? == 0 ]]; then echo \"\[$(tput setaf 1)\]└────╼ \[$(tput setaf 7)\][ssh]\"; else echo \"\[$(tput setaf 1)\]└╼ \[$(tput setaf 7)\][ssh]\"; fi) \[$(tput setaf 7)\]"
else
    export PS1="\[$(tput setaf 1)\]┌─╼ \[$(tput setaf 7)\][\w]\n\[$(tput setaf 1)\]\$(if [[ \$? == 0 ]]; then echo \"\[$(tput setaf 1)\]└────╼\"; else echo \"\[$(tput setaf 1)\]└╼\"; fi) \[$(tput setaf 7)\]"
fi

trap 'echo -ne "\e[0m"' DEBUG

# I this is an xterm set the title to user@host:dir
case "$TERM" in
    xterm*|rxvt*)
        PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u: \w\a\]$PS1"
        ;;
    *)
        ;;
esac

# Color support
if [ -x /usr/bin/dircolors ]; then
    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
    alias ls='ls --color=auto'
fi

# Alias definitions.
if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
fi

# Auto-completion 
if ! shopt -oq posix; then
    if [ -f /usr/share/bash-completion/bash_completion ]; then
        . /usr/share/bash-completion/bash_completion
    elif [ -f /etc/bash_completion ]; then
        . /etc/bash_completion
    fi
fi

# Advanced directory creation
function mkcd {
    if [ ! -n "$1" ]; then
        echo "Entrez un nom pour ce dossier"
    elif [ -d $1 ]; then
        echo "\`$1' existe déjà"
    else
        mkdir $1 && cd $1
    fi
}

# Go back with ..
b() {
    str=""
    count=0
    while [ "$count" -lt "$1" ];
    do
        str=$str"../"
        let count=count+1
    done
    cd $str
}

# Color man pages
man() {
    env \
        LESS_TERMCAP_mb=$(printf "\e[1;31m") \
        LESS_TERMCAP_md=$(printf "\e[1;31m") \
        LESS_TERMCAP_me=$(printf "\e[0m") \
        LESS_TERMCAP_se=$(printf "\e[0m") \
        LESS_TERMCAP_so=$(printf "\e[1;44;33m") \
        LESS_TERMCAP_ue=$(printf "\e[0m") \
        LESS_TERMCAP_us=$(printf "\e[1;32m") \
        man "$@"
}

# Auto cd
shopt -s autocd

# ls after a cd
function cd()
{
    builtin cd "$*" && ls
}

extract () {
    if [ -f $1 ] ; then
        case $1 in
            *.tar.bz2)   tar xjf $1     ;;
            *.tar.gz)    tar xzf $1     ;;
            *.bz2)       bunzip2 $1     ;;
            *.rar)       unrar e $1     ;;
            *.gz)        gunzip $1      ;;
            *.tar)       tar xf $1      ;;
            *.tbz2)      tar xjf $1     ;;
            *.tgz)       tar xzf $1     ;;
            *.zip)       unzip $1       ;;
            *.Z)         uncompress $1  ;;
            *.7z)        7z x $1        ;;
            *)     echo "'$1' cannot be extracted via extract()" ;;
        esac
    else
        echo "'$1' is not a valid file"
    fi
}

.bash_aliases file :

alias  venva = "source venv/bin/activate"
alias  django = "python manage.py"
alias  makemigrations = "python manage.py makemigrations"
alias  migrate = "python manage.py migrate"
alias  C24 = "cd Projects/credit-24-django/"

Could anyone be able to tell me what's wrong so far? What do I have to fix in my modify?

2

You have to remove the spaces around the = sign. So you .bash_aliases should look like follows.

alias  venva="source venv/bin/activate"
alias  django="python manage.py"
alias  makemigrations="python manage.py makemigrations"
alias  migrate="python manage.py migrate"
alias  C24="cd Projects/credit-24-django/"
1

Remove the spaces.

alias C24='cd Projects/credits-24-django/'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy