wiki/TipsShell.md

42 lines
972 B
Markdown
Raw Normal View History

2016-12-21 19:32:52 +01:00
# Astuces SHell
## Shell -> HTML
2016-12-21 19:33:17 +01:00
~~~
2016-12-21 19:32:52 +01:00
# apt install aha
$ script-foo-colors | aha > output.html
2016-12-21 19:33:17 +01:00
~~~
2016-12-21 19:32:52 +01:00
2017-01-03 09:15:29 +01:00
## Initialisation du shell
2017-01-20 10:33:36 +01:00
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
2017-01-24 11:50:40 +01:00
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
2017-03-14 12:22:58 +01:00
## 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
~~~