Created by: Snawoot
Purpose of proposed changes
- Fixes bug: message 'Something went wrong. Check nvidia driver' never displayed because
$?
always zero due to pipe containing lasthead
which always succeeds. - Fix: https://www.shellcheck.net/wiki/SC2086 -- Double quote to prevent globbing
- Fix: https://www.shellcheck.net/wiki/SC2181 -- Check exit code directly with
- Introduces strict mode of BASH operation:
- Fail and exit on any undefined variables
- Fail and exit on command errors
- Fail pipes if any command in pipe fails (it was essential for
nvidia-smi
pipe)
General purpose of changes made is to make code safer to run and eliminate possibility of unexpected behavior.
Essential steps taken
Linted code with latest stable shellcheck
, located potential and actual issues.