I don’t code, but is hardcoding sudo EVER a reasonable thing in C?
it is not
It’s not reasonable in any language
FYI, the Intel code used to be here (https://github.com/intel/thunderbolt-utils) but apparently was archived a week ago. So instead, the video creator posted the fork here: https://github.com/rxrbln/thunderbolt-utils
Putting aside the “should/shouldn’t do” argument, I was also wondering if the code is even viable. I imagine that ‘ls’ and ‘sudo’ are probably pretty ubiquitous, but I bet there exist some Linux installs out there with a different shell than ‘bash’, and some might not have ‘grep’ too. That would lead to some pretty cryptic bugs for the end user, eh?
I bet there exist some Linux installs out there with a different shell than ‘bash’,
100%. Alpine is one such distro.
That code is a crime against nature and humanity.