Corrigé 7.6 Exécution et substitution de commandes

1.

[tux]$ type cd vi find 
cd is a shell builtin 
vi is aliased to `vim' 
find is /usr/bin/find 

Dans cet exemple, la commande cd est une commande interne du shell Bash, vi est un alias de la commande vim, et find est une commande externe du shell dont le chemin absolu est /usr/bin/find.

2.

[tux]$ whereis grep ls fdisk       
grep: /bin/grep /usr/share/man/man1p/grep.1p.gz /usr/share/man/man1/grep.1.gz 
ls: /bin/ls /usr/share/man/man1p/ls.1p.gz /usr/share/man/man1/ls.1.gz 
fdisk: /sbin/fdisk /usr/share/man/man8/fdisk.8.gz 

3.

[tux]$ ps -e --no-heading | wc -l  
64 

4.

[tux]$ echo "il y a actuellement $(ps -e --no-heading | wc -l) processus" 
il y a actuellement 65 processus 
[tux]$ echo "il y a actuellement `ps -e --no-heading | wc -l` processus"  
il y a actuellement 65 processus 

5.

[tux]$ alias nbps='echo "il y a actuellement $(ps -e --no-heading | wc -l) processus"' 
[tux]$ nbps 
il y a actuellement 65 processus 
couv_TP4BLIN.png

Découvrez 

le livre :

Aussi inclus dans nos :

Précédent
Corrigé 7.5 Alias
Suivant
Corrigé 7.7 Options du shell Bash