informatique:linux:commandes_linux
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
informatique:linux:commandes_linux [2020/01/03 10:54] – [sed] pteu | informatique:linux:commandes_linux [2020/01/08 10:32] – [declare] pteu | ||
---|---|---|---|
Line 422: | Line 422: | ||
<code bash> | <code bash> | ||
# Pour afficher la date au format YYYY/ | # Pour afficher la date au format YYYY/ | ||
- | date +%Y/%m/%d-%H:%M:%S | + | date "+%Y/%m/%d %H:%M:%S" |
- | 2009/06/25-15:07:56 | + | 2009/06/25 15:07:56 |
# afficher le compteur (timestamp) de l' | # afficher le compteur (timestamp) de l' | ||
- | date +%s | + | date "+%s" |
1441816670 | 1441816670 | ||
Line 460: | Line 460: | ||
<code bash> | <code bash> | ||
pkill -USR1 dd | pkill -USR1 dd | ||
+ | </ | ||
+ | |||
+ | |||
+ | =====declare===== | ||
+ | |||
+ | Permet de déclarer des variables en bash et leur affecter des attributs ; il équivaut à la commande '' | ||
+ | |||
+ | Liste des attributs existants : | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | |||
+ | Utiliser '' | ||
+ | |||
+ | <code bash> | ||
+ | # exemple d' | ||
+ | declare -i int=2 | ||
+ | echo "int vaut $int" | ||
+ | let "int += 1" | ||
+ | echo "int vaut $int" | ||
+ | unset int | ||
+ | |||
+ | # exemple d' | ||
+ | declare -r const=pierre | ||
+ | echo "const vaut $const" | ||
+ | const=sable | ||
+ | echo "const vaut $const" | ||
</ | </ | ||
informatique/linux/commandes_linux.txt · Last modified: 2024/04/05 06:58 by pteu