From f004bd454858a758902907a8d88eed88aa2815ba Mon Sep 17 00:00:00 2001 From: vincent Date: Thu, 21 Jan 2021 19:17:39 +0100 Subject: [PATCH] add shell.md --- IT/linux/shell.md | 58 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 IT/linux/shell.md diff --git a/IT/linux/shell.md b/IT/linux/shell.md new file mode 100644 index 0000000..e5cd252 --- /dev/null +++ b/IT/linux/shell.md @@ -0,0 +1,58 @@ +#shell + +##tips + +- setter IFS au retour chariot +``` IFS=$'\n'``` + +## boucle +``` +for var in $variable +do + commande +done +``` + + +## if + +``` +if [ test ]; then + echo "C'est vrai" +else + echo "c'est faux" +fi +``` + +### test +#### string +|test|def| +|----|---| +|$a = j$b|egale| +|$a != $b|different| +|-z $a|est vide| +|-n $a|est non vide| + +#### int + +|test|def| +|----|---| +|$a -eq $b|egale| +|$a -ne $b|non egale| +|$a -lt $b| < | +|$a -le $b| <= | +|$a -gt $b| >| +|$a -ge $b| >= | + + +#### file + +|test|def| +|----|---| +|-e $a|exist| +|-d $a |is directory| +|-f $a | is file| +|-L $a | is symbolic link| +|-r -w -x | test permition| +|$a -nt $b| $a plus récent| +|$a -ot $b| $a plus vieux|