Impossible d'exécuter les aliases crées dans le .bashrc

Résolu
E_blood -  
zipe31 Messages postés 34620 Date d'inscription   Statut Contributeur Dernière intervention   -
Salut CCM.

j'ai du mal à exécuter les alias que j'ai crée sur la .bashrc de la Débian 10.4

En effet, l'alias a bien été crée dans le fichier .bashrc, j'ai actualisé, j'ai relancé la console... je crois avoir tout fait(tout ce que je connais, bien sure) mais sans solution

j'avoue que j'ai déjà plus de 3 jours entrain d'investiquer sur ce problème, et je m'en sors pas. Donc je solicite votre aide pour comprendre comment je vais résoudre, car j'avoue que sans alias je me verrai toujours obligé de retper les memes longues commande, et je vous assure que c'est pas la joie.

Merci pour tout ceux qui seront généreux de vouloir bien m'aider sur les causes de ce problème puis sur la solution

6 réponses

  1. E_Blood_007 Messages postés 4 Statut Membre
     
    Salut! je crois que je viens de trouver le problème. j'ai comparé mon "bashrc avec celui de #Zipe31" ils sont identiques. Là n'est donc pas le problème.
    Le problème je l'ai trouvé sur mon SHELL. En effet, j'utilisais le Sh et non bash, voilà pourquoi toute les modif de mon .bashrc ne conduisait à rien.

    Merci pour vos contributions, car elles ont toutes conduit à creuser jusqu'à trouver la solution.
    1
    1. zipe31 Messages postés 34620 Date d'inscription   Statut Contributeur Dernière intervention   6 501
       
      Salut,

      Merci du retour.
      En effet, j'utilisais le Sh et non bash
      En fait ce n'est même pas "sh" mais "dash", vu que
      sh
      est un lien symbolique vers
      dash
      .

      $ readlink -f /bin/sh
      /bin/dash
      0
  2. zipe31 Messages postés 34620 Date d'inscription   Statut Contributeur Dernière intervention   6 501
     
    Salut,

    Ben déjà pour commencer, nous poster le contenu de ton
    .bashrc
    histoire de voir à quoi ressemble tes alias ;-)

    0
    1. zipe31 Messages postés 34620 Date d'inscription   Statut Contributeur Dernière intervention   6 501
       
      Tapes juste la commande
      alias
      dans ton terminal et fais un copier/coller ici.
      0
  3. dubcek Messages postés 18627 Date d'inscription   Statut Contributeur Dernière intervention   5 660
     
    hello
    ou
    grep alias ~/.bashrc
    0
  4. E_Blood_007 Messages postés 4 Statut Membre
     
    Bonsoir CCM, désolé pour le silence de ma part, en effet j'avais des petits soucis avec mon compte ccm, puis avec mon modem ...
    bref je voudrais donc poursuivre la problématique posée récemment "difficulté d'executer les aliases créer dans mon .bashrc de ma Debian 10.4
    cis joint la capture de mon .bashrc

    merci pour votre aide!
    0
  5. Vous n’avez pas trouvé la réponse que vous recherchez ?

    Posez votre question
  6. Cobalt222S Messages postés 7 Statut Membre
     
    zipe31 a dt :
    > Tape juste la commande alias dans ton terminal et fais un copier/coller ici.
    0
  7. E_Blood_007 Messages postés 4 Statut Membre
     
    voici la copie complète de mon .bashrc puis le résultat des commandes (sources .bashrc et echo $SHELL ) que j'ai tapé:

     $ cat .bashrc     <br># ~/.bashrc: executed by bash(1) for non-login shells.<br># see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)<br># for examples<br><br># If not running interactively, don't do anything<br>case $- in<br>    *i*) ;;<br>      *) return;;<br>esac<br><br># don't put duplicate lines or lines starting with space in the history.<br># See bash(1) for more options<br>HISTCONTROL=ignoreboth<br><br># append to the history file, don't overwrite it<br>shopt -s histappend<br><br># for setting history length see HISTSIZE and HISTFILESIZE in bash(1)<br>HISTSIZE=1000<br>HISTFILESIZE=2000<br><br># check the window size after each command and, if necessary,<br># update the values of LINES and COLUMNS.<br>shopt -s checkwinsize<br><br># If set, the pattern "**" used in a pathname expansion context will<br># match all files and zero or more directories and subdirectories.<br>#shopt -s globstar<br><br># make less more friendly for non-text input files, see lesspipe(1)<br>#[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"<br><br># set variable identifying the chroot you work in (used in the prompt below)<br>if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then<br>    debian_chroot=$(cat /etc/debian_chroot)<br>fi<br><br># set a fancy prompt (non-color, unless we know we "want" color)<br>case "$TERM" in<br>    xterm-color|*-256color) color_prompt=yes;;<br>esac<br><br># uncomment for a colored prompt, if the terminal has the capability; turned<br># off by default to not distract the user: the focus in a terminal window<br># should be on the output of commands, not on the prompt<br>#force_color_prompt=yes<br><br>if [ -n "$force_color_prompt" ]; then<br>    if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then<br>  # We have color support; assume it's compliant with Ecma-48<br> # (ISO/IEC-6429). (Lack of such support is extremely rare, and such<br> # a case would tend to support setf rather than setaf.)<br> color_prompt=yes<br>    else<br>    color_prompt=<br>    fi<br>fi<br><br>if [ "$color_prompt" = yes ]; then<br>    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '<br>else<br>    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '<br>fi<br>unset color_prompt force_color_prompt<br><br># If this is an xterm set the title to user@host:dir<br>case "$TERM" in<br>xterm*|rxvt*)<br>    PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"<br>    ;;<br>*)<br>    ;;<br>esac<br><br># enable color support of ls and also add handy aliases<br>if [ -x /usr/bin/dircolors ]; then<br>    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"<br>    alias ls='ls --color=auto'<br>    #alias dir='dir --color=auto'<br>    #alias vdir='vdir --color=auto'<br>alias testNagios='/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg'<br><br><br>    #alias grep='grep --color=auto'<br>    #alias fgrep='fgrep --color=auto'<br>    #alias egrep='egrep --color=auto'<br>fi<br><br># colored GCC warnings and errors<br>#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'<br><br># some more ls aliases<br> alias ll='ls -l'<br>#alias la='ls -A'<br>#alias l='ls -CF'<br><br># Alias definitions.<br># You may want to put all your additions into a separate file like<br># ~/.bash_aliases, instead of adding them here directly.<br># See /usr/share/doc/bash-doc/examples in the bash-doc package.<br><br>if [ -f ~/.bash_aliases ]; then<br>    . ~/.bash_aliases<br>fi<br><br># enable programmable completion features (you don't need to enable<br># this, if it's already enabled in /etc/bash.bashrc and /etc/profile<br># sources /etc/bash.bashrc).<br>if ! shopt -oq posix; then<br>  if [ -f /usr/share/bash-completion/bash_completion ]; then<br>    . /usr/share/bash-completion/bash_completion<br>  elif [ -f /etc/bash_completion ]; then<br>    . /etc/bash_completion<br>  fi<br>fi<br> ##Alias ajoutés. <br><br> alias testNagios='/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg'<br> alias restartNagios='sudo systemctl restart nagios'<br>$ <br>$ <br>$ <br>$ pwd <br>/home/nagios<br>$ <br>$ source .bashrc<br>-sh: 19: source: not found<br>$ <br>$ echo $SHELL<br>/bin/sh<br><br><br>
    
    -
    


    je signale qu'en tapant # allias , la liste de mes allias ne s'affiche pas
    0
    1. zipe31 Messages postés 34620 Date d'inscription   Statut Contributeur Dernière intervention   6 501
       
      Il est tout pourri ton fichier
      Qu'est-ce que font les balises html
      <br>
      à l'intérieur ?

      Et puis la commande c'est
      alias
      avec un seul L.

      La sortie (modifiée) devrait ressembler à ça :

      # ~/.bashrc: executed by bash(1) for non-login shells.
      # see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
      # for examples
      
      # 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.
      # See bash(1) for more options
      HISTCONTROL=ignoreboth
      
      # append to the history file, don't overwrite it
      shopt -s histappend
      
      # for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
      HISTSIZE=1000
      HISTFILESIZE=2000
      
      # check the window size after each command and, if necessary,
      # update the values of LINES and COLUMNS.
      shopt -s checkwinsize
      
      # If set, the pattern "**" used in a pathname expansion context will
      # match all files and zero or more directories and subdirectories.
      #shopt -s globstar
      
      # make less more friendly for non-text input files, see lesspipe(1)
      #[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
      
      # set variable identifying the chroot you work in (used in the prompt below)
      if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
          debian_chroot=$(cat /etc/debian_chroot)
      fi
      
      # set a fancy prompt (non-color, unless we know we "want" color)
      case "$TERM" in
          xterm-color|*-256color) color_prompt=yes;;
      esac
      
      # uncomment for a colored prompt, if the terminal has the capability; turned
      # off by default to not distract the user: the focus in a terminal window
      # should be on the output of commands, not on the prompt
      #force_color_prompt=yes
      
      if [ -n "$force_color_prompt" ]; then
          if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
        # We have color support; assume it's compliant with Ecma-48
       # (ISO/IEC-6429). (Lack of such support is extremely rare, and such
       # a case would tend to support setf rather than setaf.)
       color_prompt=yes
          else
          color_prompt=
          fi
      fi
      
      if [ "$color_prompt" = yes ]; then
          PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
      else
          PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
      fi
      unset color_prompt force_color_prompt
      
      # If this is an xterm set the title to user@host:dir
      case "$TERM" in
      xterm*|rxvt*)
          PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
          ;;
      *)
          ;;
      esac
      
      # enable color support of ls and also add handy aliases
      if [ -x /usr/bin/dircolors ]; then
          test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
          alias ls='ls --color=auto'
          #alias dir='dir --color=auto'
          #alias vdir='vdir --color=auto'
      alias testNagios='/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg'
      
      
          #alias grep='grep --color=auto'
          #alias fgrep='fgrep --color=auto'
          #alias egrep='egrep --color=auto'
      fi
      
      # colored GCC warnings and errors
      #export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
      
      # some more ls aliases
       alias ll='ls -l'
      #alias la='ls -A'
      #alias l='ls -CF'
      
      # Alias definitions.
      # You may want to put all your additions into a separate file like
      # ~/.bash_aliases, instead of adding them here directly.
      # See /usr/share/doc/bash-doc/examples in the bash-doc package.
      
      if [ -f ~/.bash_aliases ]; then
          . ~/.bash_aliases
      fi
      
      # enable programmable completion features (you don't need to enable
      # this, if it's already enabled in /etc/bash.bashrc and /etc/profile
      # sources /etc/bash.bashrc).
      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
       ##Alias ajoutés. 
      
       alias testNagios='/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg'
       alias restartNagios='sudo systemctl restart nagios'
      
      0
      1. zipe31 Messages postés 34620 Date d'inscription   Statut Contributeur Dernière intervention   6 501 > zipe31 Messages postés 34620 Date d'inscription   Statut Contributeur Dernière intervention  
         
        Tiens je te colle le contenu de mon .
        bashrc
        sur une Raspbian + la sortie de la commande
        alias
        et le résultat de la commande l
        sb_release -a
        :

        # ~/.bashrc: executed by bash(1) for non-login shells.
        # see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
        # for examples
        
        # 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.
        # See bash(1) for more options
        HISTCONTROL=ignoreboth
        
        # append to the history file, don't overwrite it
        shopt -s histappend
        
        # for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
        HISTSIZE=1000
        HISTFILESIZE=2000
        
        # check the window size after each command and, if necessary,
        # update the values of LINES and COLUMNS.
        shopt -s checkwinsize
        
        # If set, the pattern "**" used in a pathname expansion context will
        # match all files and zero or more directories and subdirectories.
        #shopt -s globstar
        
        # make less more friendly for non-text input files, see lesspipe(1)
        #[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
        
        # set variable identifying the chroot you work in (used in the prompt below)
        if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
            debian_chroot=$(cat /etc/debian_chroot)
        fi
        
        # set a fancy prompt (non-color, unless we know we "want" color)
        case "$TERM" in
            xterm-color) color_prompt=yes;;
        esac
        
        # uncomment for a colored prompt, if the terminal has the capability; turned
        # off by default to not distract the user: the focus in a terminal window
        # should be on the output of commands, not on the prompt
        force_color_prompt=yes
        
        if [ -n "$force_color_prompt" ]; then
            if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
                # We have color support; assume it's compliant with Ecma-48
                # (ISO/IEC-6429). (Lack of such support is extremely rare, and such
                # a case would tend to support setf rather than setaf.)
                color_prompt=yes
            else
                color_prompt=
            fi
        fi
        
        if [ "$color_prompt" = yes ]; then
            PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w \$\[\033[00m\] '
        else
            PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
        fi
        unset color_prompt force_color_prompt
        
        # If this is an xterm set the title to user@host:dir
        case "$TERM" in
        xterm*|rxvt*)
            PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
            ;;
        *)
            ;;
        esac
        
        # enable color support of ls and also add handy aliases
        if [ -x /usr/bin/dircolors ]; then
            test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
            alias ls='ls --color=auto'
            #alias dir='dir --color=auto'
            #alias vdir='vdir --color=auto'
        
            alias grep='grep --color=auto'
            alias fgrep='fgrep --color=auto'
            alias egrep='egrep --color=auto'
        fi
        
        # colored GCC warnings and errors
        #export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
        
        # some more ls aliases
        #alias ll='ls -l'
        #alias la='ls -A'
        #alias l='ls -CF'
        
        # Alias definitions.
        # You may want to put all your additions into a separate file like
        # ~/.bash_aliases, instead of adding them here directly.
        # See /usr/share/doc/bash-doc/examples in the bash-doc package.
        
        if [ -f ~/.bash_aliases ]; then
            . ~/.bash_aliases
        fi
        
        # enable programmable completion features (you don't need to enable
        # this, if it's already enabled in /etc/bash.bashrc and /etc/profile
        # sources /etc/bash.bashrc).
        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


        pi@pi-rogue:~ $ alias
        alias egrep='egrep --color=auto'
        alias fgrep='fgrep --color=auto'
        alias grep='grep --color=auto'
        alias ls='ls --color=auto'


        pi@pi-rogue:~ $ lsb_release -a
        No LSB modules are available.
        Distributor ID: Raspbian
        Description: Raspbian GNU/Linux 9.11 (stretch)
        Release: 9.11
        Codename: stretch
        0