Fermer2
FarewellLe 23/08/2012 à 21:16
yop,


J'ai installé une KDE 11.10 hier, pour profiter de ce fabuleux bureau : http://www.trinitydesktop.org/ love
Mais trêve de pub. Je n'arrive pas à paramétrer Bash de la même manière que je le fais sur mes autres distros.

Dans man (bash), on lit que /etc/profile est lu quand on démarre une session Bash.
Et dans ce fichier, j'ai ajouté ça :
# Added for GCC4TI
BASH_ENV = ~/.autoexec

Mon .autoexec contient ça ;
#!/bin/bash

.gcc4ti

Et enfin .gcc4ti :
#!/bin/bash

TIGCC="/usr/local/share/gcc4ti"
export TIGCC

PATH="$PATH:$TIGCC/bin"
export TIGCC

Donc a priori, j'ai tout ce qu'il faut pour pouvoir lancer tigcc dans n'importe quel shell.
Problème, quand je lance konsole, qui utilise Bash, TIGCC n'est pas défini. Et même pas BASH_ENV, alors que /etc/profile doit être lu, dixit la doc :
When  bash is invoked as an interactive login shell, or as a non-interactive shell with the --login option, it first reads and executes commands from the file /etc/profile, if that file exists.  After reading that
file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable.  The --noprofile option may be used when the  shell
is started to inhibit this behavior.

Hors, pour cet autre raison :
When bash is started non-interactively, to run a shell script, for example, it looks for the variable BASH_ENV in the environment, expands its value if it appears there, and uses the expanded value as the name  of
a file to read and execute.  Bash behaves as if the following command were executed:
       if [ -n "$BASH_ENV" ]; then . "$BASH_ENV"; fi
but the value of the PATH variable is not used to search for the file name.

il m'est absolument impératif d'avoir BASH_ENV défini.

Alors vers où chercher ? Comment se fait-il que BASH_ENV ne soit pas défini ?

Je poste ici mon /etc/profile, il est peut-être pas du tout standard après tout (même si sur au moins une autre de mes distros, le fichier est identique, mis à part le fait que les deux blocs soient en ordre inverse) :
# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).

if [ -d /etc/profile.d ]; then
  for i in /etc/profile.d/*.sh; do
    if [ -r $i ]; then
      . $i
    fi
  done
  unset i
fi

if [ "$PS1" ]; then
  if [ "$BASH" ]; then
    # The file bash.bashrc already sets the default PS1.
    # PS1='\h:\w\$ '
    if [ -f /etc/bash.bashrc ]; then
      . /etc/bash.bashrc
    fi
  else
    if [ "`id -u`" -eq 0 ]; then
      PS1='# '
    else
      PS1='$ '
    fi
  fi
fi

# Added for GCC4TI
BASH_ENV = ~/.autoexec



Voilà, si vous avez une piste, ça m'évitera de me retaper la définition des variables pour GCC4TI à chaque fois...

Merci d'avance. smile