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édente | ||
programmation_bash [2009/05/26 14:29] – thierry | programmation_bash [2010/04/29 09:32] (Version actuelle) – thierry | ||
---|---|---|---|
Ligne 97: | Ligne 97: | ||
GNU bash, version 3.2.39(1)-release (i486-pc-linux-gnu) | GNU bash, version 3.2.39(1)-release (i486-pc-linux-gnu) | ||
Copyright (C) 2007 Free Software Foundation, Inc. | 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:// | ||
+ | |||
+ | ====== awk ====== | ||
+ | |||
+ | ===== /etc/passwd ===== | ||
+ | |||
+ | cat /etc/passwd | awk -F':' | ||
programmation_bash.txt · Dernière modification : 2010/04/29 09:32 de thierry