57 lines
2.6 KiB
Plaintext
57 lines
2.6 KiB
Plaintext
Notes :
|
||
Avec ls-d :
|
||
- * => n'importe quelle chaine de caractères
|
||
- ? => un caractère unique quelconque
|
||
|
||
-[[:upper:]] Maj
|
||
-[[ :lower: ]] Minuscule
|
||
-[[:digit:]] chiffre
|
||
I.
|
||
|
||
1.ls -d GLOB/gLob/*[[:upper:]] -> Affiche : GLOB/gLob/44patterN
|
||
|
||
2.ls -d GLOB/*[[:upper:]]*
|
||
|
||
3ls -d GLOB/?[[:digit:]]* GLOB/gLob/?[[:digit:]]*
|
||
|
||
4.ls -d GLOB/*[[:digit:]][[:digit:]]*
|
||
|
||
|
||
(on finiras au prochain TP)
|
||
|
||
|
||
II.
|
||
|
||
shopt : shopt [-pqsu] [-o] [optname ...]
|
||
Toggle the values of settings controlling optional shell behavior. The settings can be either those
|
||
listed below, or, if the -o option is used, those available with the -o option to the set builtin com‐
|
||
mand. With no options, or with the -p option, a list of all settable options is displayed, with an indi‐
|
||
cation of whether or not each is set; if optnames are supplied, the output is restricted to those op‐
|
||
tions. The -p option causes output to be displayed in a form that may be reused as input. Other options
|
||
have the following meanings:
|
||
-s Enable (set) each optname.
|
||
-u Disable (unset) each optname.
|
||
-q Suppresses normal output (quiet mode); the return status indicates whether the optname is set or
|
||
unset. If multiple optname arguments are given with -q, the return status is zero if all optnames
|
||
are enabled; non‐zero otherwise.
|
||
-o Restricts the values of optname to be those defined for the -o option to the set builtin.
|
||
|
||
If either -s or -u is used with no optname arguments, shopt shows only those options which are set or un‐
|
||
set, respectively. Unless otherwise noted, the shopt options are disabled (unset) by default.
|
||
|
||
The return status when listing options is zero if all optnames are enabled, non‐zero otherwise. When
|
||
setting or unsetting options, the return status is zero unless an optname is not a valid shell option.
|
||
|
||
1. (faire "man bash", puis faire "/shopt" puis appuyer sur espace jusqu'à arriver au bon endroit)
|
||
|
||
2. shopt permet d'activer/désactiver des options/paramètres du bash.
|
||
|
||
3.
|
||
|
||
a) le bash va comprendre *5 comme étant un fichier et va donc nous dire qu'il n'existe pas
|
||
|
||
b)shopt -s nullglob
|
||
|
||
c) après avoir activé nullglob, le bash va sauter ce qu'il ne comprends pas.
|
||
|
||
par conséquent, "cd *5" va être compris comme étant "cd" et va donc nous mettre sur le répertoire courant (~). |