What was the return code of the last command?

Published: Wednesday, Dec 26, 2007 Last modified: Monday, Apr 8, 2024

Use:

echo $?

Example:

bilbo$ df -h

Filesystem            Size  Used Avail Use% Mounted on

/dev/hda1              19G  3.6G   14G  21% /

tmpfs                 253M     0  253M   0% /dev/shm

/dev/hda3              92G   35G   53G  40% /home

bilbo$ echo $?

0