programmation_bash
Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédenteDernière révisionLes deux révisions suivantes | ||
programmation_bash [2009/05/26 14:28] – thierry | programmation_bash [2009/08/17 15:43] – thierry | ||
---|---|---|---|
Ligne 93: | Ligne 93: | ||
if [[ " | if [[ " | ||
... | ... | ||
+ | |||
+ | $ sh --version | ||
+ | GNU bash, version 3.2.39(1)-release (i486-pc-linux-gnu) | ||
+ | Copyright (C) 2007 Free Software Foundation, Inc. | ||
+ | |||
+ | ===== Delimiteurs ===== | ||
+ | Lien: http:// | ||
+ | |||
+ | Exemple: | ||
+ | #!/bin/sh | ||
+ | | ||
+ | cat /etc/passwd | while read line; do | ||
+ | | ||
+ | IFS=":" | ||
+ | read username pass auid agid agroup ahome ashell <<EOF | ||
+ | $line | ||
+ | EOF | ||
+ | | ||
+ | echo " | ||
+ | echo " | ||
+ | | ||
+ | done | ||
+ | | ||
+ | unset IFS | ||
+ | |||
+ | #!/bin/sh | ||
+ | | ||
+ | IFS=":" | ||
+ | read first_name last_name | ||
+ | | ||
+ | echo "1: $first_name" | ||
+ | echo "2: $last_name" | ||
+ | | ||
+ | unset IFS | ||
+ | |||
+ | Output du dernier exemple: | ||
+ | 1: hello | ||
+ | 2: ducon | ||
+ | |||
+ | ===== LOCK ===== | ||
+ | Realiser un LOCK sur un scripte... | ||
+ | |||
+ | Lien: http:// | ||
+ | |||
+ | Pour resumer: la seule solution portable est d' | ||
+ | |||
+ | Voir aussi " | ||
+ | |||
+ | ===== TRAP ===== | ||
+ | |||
+ | Comment traper les signaux, ou simplement la sortie du script... | ||
+ | |||
+ | Lien: http:// | ||
programmation_bash.txt · Dernière modification : 2010/04/29 09:32 de thierry