wiki/TipsShell.md
pdiogoantunes af9733f885 EDITOR
2017-03-14 12:22:58 +01:00

42 lines
972 B
Markdown

# Astuces SHell
## Shell -> HTML
~~~
# apt install aha
$ script-foo-colors | aha > output.html
~~~
## Initialisation du shell
Entre les 3 modes ("login", "interactive non-login" et "non-interactive non-login") il y a de quoi se perdre à propos des fichiers chargés. Voici un rappel assez complet : <https://github.com/rbenv/rbenv/wiki/Unix-shell-initialization>
## Script shell
Style guide : <https://google.github.io/styleguide/shell.xml>
## History Bash
`bashrc` :
~~~
export HISTCONTROL=$HISTCONTROL${HISTCONTROL+,}ignoreboth
export HISTSIZE=65535
export HISTTIMEFORMAT="%c : "
~~~
> *Note* : si besoin on peut `chattr +a /root/.bash_history` pour empêcher sa suppression
## Changer l'editeur de texte par défaut pour une commande
Normalement le script (vipw, vigr, -ldapvi, ...) se réfère aux fichiers (qui ne sont que des liens vers les binaires) :
~~~{.bash}
/etc/alternatives/
~~~
Sinon en ligne de commande :
~~~{.bash}
$ EDITOR=nano vipw
~~~