15-03-2019
This commit is contained in:
@@ -40,6 +40,9 @@ then
|
||||
elif [ $foo -eq 2 ]
|
||||
then
|
||||
echo "Two"
|
||||
elif [ $foo -eq 3 ]
|
||||
then
|
||||
echo "Three"
|
||||
else
|
||||
echo "Bigger than two"
|
||||
fi
|
||||
@@ -63,6 +66,12 @@ then
|
||||
echo "Either you didn't give me a value or file is unreadable"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
|
||||
if [ $num -gt 100 ] && [ $num -lt 200 ]
|
||||
then
|
||||
echo "The number lies between 100 and 200"
|
||||
fi
|
||||
```
|
||||
|
||||
|
||||
@@ -243,7 +252,7 @@ if [ olderfile -ot newerfile ]; then
|
||||
if [ /mnt/remote/remotefile -ot localfile ]; then
|
||||
```
|
||||
|
||||
Si les fichiers <u>*same et file font référence au même device / inode*</u>
|
||||
Si les fichiers <u>*same et file font référence au même device / inode*</u>.
|
||||
|
||||
```bash
|
||||
if [ same -ef file ]; then
|
||||
@@ -251,7 +260,15 @@ if [ same -ef file ]; then
|
||||
if [ /dev/cdrom -ef /dev/dvd ]; then
|
||||
```
|
||||
|
||||
Si un fichier a été <u>modifié durant les 5 dernières minutes</u>.
|
||||
|
||||
```bash
|
||||
dir="/usr/local/etc/httpd"
|
||||
name="httpd.conf"
|
||||
|
||||
test=$(find $dir -name "$name" -mmin -5 -maxdepth 1)
|
||||
[ ! -z $test ] && echo -e "\033[1;31m❗️ ️$name was modified in the last 5 minutes\033[0m"
|
||||
```
|
||||
|
||||
|
||||
|
||||
@@ -266,19 +283,19 @@ if [ “$1” == “moo” ]; then
|
||||
Si les chaines sont <u>*différentes*</u> [ STRING1 != STRING2 ]
|
||||
|
||||
```bash
|
||||
if [ “$userinput” != “$password” ];
|
||||
if [ “$userinput” != “$password” ]; then
|
||||
```
|
||||
|
||||
Si la chaine 1 <u>*est triée après*</u> la chaine 2 [ STRING1 > STRING2 ]
|
||||
|
||||
```bash
|
||||
if [ “$userinput” > “$password” ];
|
||||
if [ “$userinput” > “$password” ]; then
|
||||
```
|
||||
|
||||
Si la chaine 1 <u>*est triée avant*</u> la chaine 2 [ STRING1 < STRING2 ]
|
||||
|
||||
```bash
|
||||
if [ “$userinput” < “$password” ];
|
||||
if [ “$userinput” < “$password” ]; then
|
||||
```
|
||||
|
||||
Si la chaine <u>*NONEMPTYSTRING a une longueur > 0*</u> (contient 1 ou plusieurs caractères)
|
||||
|
||||
Reference in New Issue
Block a user