Archives pour l'étiquette bashrc

Mac OS X terminal: Un peu de couleur dans la console

Terminal OS X

Pour les néophyte unix soyez rassuré ceci fonctionne aussi bien sur Tiger, Leopard ou Snow Leopard

.bashrc

Voici un .bashrc à placer dans votre /home sur votre mac pour avoir un peu plus de couleur dans votre terminal (terminal.app). Attention à sauvegarder votre précédent .batchrc

<span style="color: #808080; font-style: italic;"># ~/.bashrc: executed by bash(1) for non-login shells.</span> &nbsp; <span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">PS1=</span><span style="color: #ff0000;">'<span style="color: #000099; font-weight: bold;">\h</span>:<span style="color: #000099; font-weight: bold;">\w</span><span style="color: #000099; font-weight: bold;">\$</span> '</span> <span style="color: #7a0874; font-weight: bold;">umask</span> <span style="color: #000000;">022</span> &nbsp; <span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">CLICOLOR=</span><span style="color: #000000;">1</span> &nbsp; <span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">ll=</span><span style="color: #ff0000;">'ls -l'</span> <span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">la=</span><span style="color: #ff0000;">'ls -A'</span> <span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">vi=</span><span style="color: #ff0000;">'vim'</span> <span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">l=</span><span style="color: #ff0000;">'ls -CF'</span> &nbsp; <span style="color: #000000; font-weight: bold;">function</span> cyan_red_prompt <span style="color: #7a0874; font-weight: bold;">&#123;</span> &nbsp; <span style="color: #7a0874; font-weight: bold;">local</span> <span style="color: #007800;">CYAN=</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\[</span><span style="color: #000099; font-weight: bold;">\0</span>33[0;36m<span style="color: #000099; font-weight: bold;">\]</span>&quot;</span> <span style="color: #7a0874; font-weight: bold;">local</span> <span style="color: #007800;">GRAY=</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\[</span><span style="color: #000099; font-weight: bold;">\0</span>33[0;37m<span style="color: #000099; font-weight: bold;">\]</span>&quot;</span> <span style="color: #7a0874; font-weight: bold;">local</span> <span style="color: #007800;">RED=</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\[</span><span style="color: #000099; font-weight: bold;">\0</span>33[0;31m<span style="color: #000099; font-weight: bold;">\]</span>&quot;</span> &nbsp; <span style="color: #007800;">PS1=</span><span style="color: #ff0000;">&quot;${CYAN}[<span style="color: #000099; font-weight: bold;">\u</span>@<span style="color: #000099; font-weight: bold;">\h</span> ${RED}<span style="color: #000099; font-weight: bold;">\w</span>${CYAN}]${GRAY} &quot;</span> <span style="color: #7a0874; font-weight: bold;">&#125;</span> &nbsp; cyan_red_prompt

.profile Et voici le .profile à placer également dans votre home pour lancer le .bashrc

<span style="color: #808080; font-style: italic;"># ~/.profile: executed by the command interpreter for login shells.</span> <span style="color: #808080; font-style: italic;"># This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login</span> <span style="color: #808080; font-style: italic;"># exists.</span> <span style="color: #808080; font-style: italic;"># see /usr/share/doc/bash/examples/startup-files for examples.</span> <span style="color: #808080; font-style: italic;"># the files are located in the bash-doc package.</span> &nbsp; <span style="color: #808080; font-style: italic;"># the default umask is set in /etc/profile</span> <span style="color: #808080; font-style: italic;">#umask 022</span> &nbsp; <span style="color: #808080; font-style: italic;"># if running bash</span> <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> -n <span style="color: #ff0000;">&quot;$BASH_VERSION&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>     <span style="color: #808080; font-style: italic;"># include .bashrc if it exists</span>     <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> -f ~<span style="color: #000000; font-weight: bold;">/</span>.bashrc <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>         . ~<span style="color: #000000; font-weight: bold;">/</span>.bashrc     <span style="color: #000000; font-weight: bold;">fi</span> <span style="color: #000000; font-weight: bold;">fi</span> &nbsp; <span style="color: #808080; font-style: italic;"># set PATH so it includes user's private bin if it exists</span> <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> -d ~<span style="color: #000000; font-weight: bold;">/</span>bin <span style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span style="color: #000000; font-weight: bold;">then</span>     <span style="color: #007800;">PATH=</span>~<span style="color: #000000; font-weight: bold;">/</span>bin:<span style="color: #ff0000;">&quot;${PATH}&quot;</span> <span style="color: #000000; font-weight: bold;">fi</span>