$ sudo foo
sudo: foo: command not found
indicates that sudo couldn‘t access the command you want to run. Typical reasons for this are
the command (binary) does not exist,
the command is not in $PATH,...
I solved this a while go and will explain the problem before what I used for the solution.
Probably a lack of experience here with this component of macOS but the need was to collect disk names and ...