Si on veut récupérer la fonction ou l'alias associé avec une commande, on peut demander de l'afficher avec la commande
command -V commande_à_chercher. Le résultat est :
grep is aliased to `grep --color=auto --line-buffered'
ou le contenu d'une fonction :
color is a function
color ()
{
if [ -z $1 ]; then
echo "cat /etc/passwd | color 'recherche' ['couleur']";
echo "Couleurs : rouge gris vert violet marine rose cyan bleu gras";
return;
fi;
case "$2" in
"rouge")
GREP_COLOR="01;31" egrep --color=always --line-buffered "^|$1"
;;
"gris")
GREP_COLOR="01;30" egrep --color=always --line-buffered "^|$1"
;;
"vert")
GREP_COLOR="01;32" egrep --color=always --line-buffered "^|$1"
;;
"violet")
GREP_COLOR="01;33" egrep --color=always --line-buffered "^|$1"
;;
"marine")
GREP_COLOR="01;34" egrep --color=always --line-buffered "^|$1"
;;
"rose")
GREP_COLOR="01;35" egrep --color=always --line-buffered "^|$1"
;;
"cyan")
GREP_COLOR="01;36" egrep --color=always --line-buffered "^|$1"
;;
"bleu")
GREP_COLOR="01;37" egrep --color=always --line-buffered "^|$1"
;;
"gras")
GREP_COLOR="01;38" egrep --color=always --line-buffered "^|$1"
;;
"help")
echo "Couleurs : rouge gris vert violet marine rose cyan bleu gras"
;;
*)
GREP_COLOR="01;31" egrep --color=always --line-buffered "^|$1"
;;
esac
}