

Autour de LDAP
Awstats
Backup HP COLORADO 5G
Compatibilit� Linux
Configuration NFS
Configuration ZSH
Configuration de FreeBSD
Connexion ADSL PPPOE
IPFILTER
Installation PXE
Installation d'un DNS
Installation d'un Squirrelmail
Installation de Apache SSL
Installation de FreeBSD
Installation de GRUB
Installation de MailScanner
Installation de PostgreSQL
Jail sous FreeBSD
Mise a jour de votre FreeBSD
Serveur CVS
Serveur DHCPd
Serveur IRCd
Serveur NTPd
Serveur ProFTPd
Serveur at home
Utilisation simple de CVS
X11: interface graphique




Et aussi ...
rockanjou.org
|
Installer et configurer un zsh sur FreeBSD
Pour commencer il faut installer ZSH, on utilise ici portinstall, voir documentation sur portinstall.
portinstall zsh
Une fois l'installation termin�e, on commence � cr�er la configuration, pour son utilisateur UNIX, ici lecid :
cd
mkdir .zsh
mkdir .zsh/rc
mkdir .zsh/scripts
Le r�pertoire scripts contiendra les scripts zsh sp�cifiques � notre prompt.
Editons le fichier d'initialisation de ZSh, $HOME/.zshr
c :
vi /home/lecid/.zshrc
--
# Resource files
for file in $HOME/.zsh/rc/*; do
source $file
done
On met en oeuvre le script rc pour la completion �tendue de ZSH :
vi /home/lecid/.zsh/rc/completion
--
autoload -U compinit
compinit
fpath=(~/zfunc $fpath)
On met en oeuvre le script rc pour la d�finition de l'environnement de ZSH :
vi /home/lecid/.zsh/rc/env
--
# si vous travail sous X
export TERM='xterm-color'
# alias de base
alias la='ls -la'
alias ll='ls -l'
# for ls
export BLOCKSIZE=K
export CLICOLOR=enable
# env global
export EDITOR='ee'
export PAGER='less'
# FreeBSD ls
export LSCOLORS='cxgxhxhxbxhxhxbabacaca'
On met en oeuvre le script rc pour la d�finition de l'historisation des commandes de ZSH :
vi /home/lecid/.zsh/rc/history
--
HISTFILE=~/.history
HISTSIZE=1000
SAVEHIST=1000
LANGUAGE=fr_FR
export LANG HISTSIZE HISTFILE SAVEHIST LANGUAGE LC_ALL LC_MESSAGE
Et enfin, on met en oeuvre le script rc pour la d�finition du prompt de ZSH (version sp�ciale) :
vi /home/lecid/.zsh/rc/prompt
--
autoload -U colors
colors
host_color="green"
path_color="yellow"
date_color="`zsh /home/lecid/.zsh/scripts/load`"
date_format="%H:%M:%S"
date="%{$fg[$date_color]%}%D{$date_format}"
host="%{$fg[$host_color]%}[%n@%m]"
cpath="%B%{$fg[$path_color]%}%/%b"
end="%{$reset_color%}"
PS1="$host$cpath$end#"
RPS1="$date$end"
On voit ici la r�f�rence � un script shell externe � rc qui colorise l'heure en fonction de la charge de la machine
:
vi /home/lecid/.zsh/scripts/load
--
#!/usr/local/bin/zsh
declare -i Up=`uptime | awk '{print $10}' | cut -f1 -d ',' `
if [ $Up -ge 2 ]
then
echo 'red'
exit
else
if [ $Up -lt 1 ]
then
echo 'green'
exit
else
echo 'yellow'
exit
fi
fi
Une fois la configuration termin�e on peut choisir zsh comme shell par defaut :
chsh
Un buffer s'ouvre dans votre editeur par d�faut, modifier le comme tel et sauver pour op�rer la modification :
#Changing user database information for lecid.
Shell: /usr/local/bin/zsh
Full Name: Georges Romain
Office Location:
Office Phone:
Home Phone:
Other information:
Vous voil� un power user :) !
Romain GEORGES le 2003/01/28 |
|