Différences
Cette page vous affiche les différences entre la révision choisie et la version actuelle de la page.
outils:screen [2008/03/26 04:27] lj |
outils:screen [2008/03/26 04:33] (Version actuelle) lj |
||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
+ | ====== Screen ====== | ||
+ | ===== Présentation ===== | ||
+ | |||
+ | * [[http://www.clx.anet.fr/spip/article.php3?id_article=242|Introduction à screen]] | ||
+ | |||
+ | ===== Configuration (barre de statut et une barre de titre) ===== | ||
+ | Exemple de configuration utilisant une barre de statut et une barre de titre : | ||
+ | |||
+ | <code> | ||
+ | caption always "%{= bb}%{+b w}%h %=%t %c" | ||
+ | hardstatus alwayslastline "%-Lw%{= BW}%50>%n%f* %t%{-}%+Lw%<" | ||
+ | </code> | ||
+ | |||
+ | Les deux sont modifiables via le shell en utilisant des séquences d'échappement particulières, par exemple, en [[:shell:zsh]] on aura | ||
+ | quelque chose du genre : | ||
+ | |||
+ | <code> | ||
+ | function title { | ||
+ | # Use these two for GNU Screen: | ||
+ | local myhost | ||
+ | myhost=${$(hostname)//.*/} | ||
+ | print -nR $'\033k'$myhost$'\033'\\ | ||
+ | print -nR $'\033]0;'$1$'\a' | ||
+ | } | ||
+ | |||
+ | preexec () { | ||
+ | emulate -L zsh | ||
+ | local -a cmd; cmd=(${(z)1}) | ||
+ | title ${$(hostname)//.*/} "$cmd[1,-1]" | ||
+ | } | ||
+ | </code> | ||
+ | |||
+ | Pour mettre de façon automatique la barre de statut. | ||
+ | |||
+ | {{outils:shell.png}} | ||
+ | |||
+ | ===== Configuration (affiche $PWD ainsi que la commande en cours) ===== | ||
+ | Exemple de configuration affichant $PWD ainsi ainsi que la commande en cours [[:shell:zsh]] : | ||
+ | |||
+ | <code> | ||
+ | caption always "%{+u ck}%?%-w%?%{mk}[%t]%{ck}%?%+w%?" | ||
+ | hardstatus alwayslastline "%{kc} @%{+b kw}%H%{-b kc} %c-%D %d/%m/%y %{kc} ld: %l %{kc} %{kc}%1`%= %2`%= %{kc}" | ||
+ | </code> | ||
+ | |||
+ | <code> | ||
+ | if [[ $TERM == "screen" ]]; then | ||
+ | TAB_TITLE_PREFIX='"${USER}$PROMPT_CHAR"' | ||
+ | TAB_TITLE_PROMPT='`echo $PWD | sed "s/^\/Users\//~/;s/^~$USER/~/;s/\/..*\//\/...\//"`' | ||
+ | TAB_TITLE_EXEC='$cmd[1]:t' | ||
+ | TAB_HARDSTATUS_PREFIX='"[`echo $PWD | sed "s/^\/Users\//~/;s/^~$USER/~/"`] "' | ||
+ | TAB_HARDSTATUS_PROMPT='$SHELL:t' | ||
+ | TAB_HARDSTATUS_EXEC='$cmd' | ||
+ | |||
+ | function screen_set() | ||
+ | { | ||
+ | print -nR $'\033k'$1$'\033'\\\ | ||
+ | print -nR $'\033]0;'$2$'\a' | ||
+ | } | ||
+ | function preexec() | ||
+ | { | ||
+ | local -a cmd; cmd=(${(z)1}) # the command string | ||
+ | eval "tab_title=$TAB_TITLE_PREFIX$TAB_TITLE_EXEC" | ||
+ | eval "tab_hardstatus=$TAB_HARDSTATUS_PREFIX$TAB_HARDSTATUS_EXEC" | ||
+ | screen_set $tab_title $tab_hardstatus | ||
+ | } | ||
+ | function precmd() | ||
+ | { | ||
+ | eval "tab_title=$TAB_TITLE_PREFIX$TAB_TITLE_PROMPT" | ||
+ | eval "tab_hardstatus=$TAB_HARDSTATUS_PREFIX$TAB_HARDSTATUS_PROMPT" | ||
+ | screen_set $tab_title $tab_hardstatus | ||
+ | } | ||
+ | fi | ||
+ | </code> | ||
+ | |||
+ | {{outils:sheel1.png}} | ||
+ | |||
+ | À voir également : | ||
+ | |||
+ | * [[config:asyd|Fichiers de configurations d'asyd]] |
outils/screen.txt · Dernière modification: 2008/03/26 04:33 par lj