uptime ignores extra argv
Problem: user expected "uptime" to report on another host, e.g. uptime myserver
. This "fails" silently because non-option arguments are ignored.
Although the getopt call handles --nosuchoption
cases and prints an error, suggest that optind is compared to argc to print an error.
To be clear, there is nothing contrary in the documentation, just an assumption from the user that this feature exists. It would help to be more explicit when unprocessed argv is given.
$ uptime --version
uptime from procps-ng 3.3.12
$ uptime --abc
uptime: unrecognized option '--abc'
Usage:
uptime [options]
Options:
-p, --pretty show uptime in pretty format
-h, --help display this help and exit
-s, --since system up since
-V, --version output version information and exit
For more details see uptime(1).
### problem is here
$ uptime webserver123.example.com
09:47:13 up 14 min, 0 users, load average: 0.52, 0.58, 0.59