I don’t code, but is hardcoding sudo EVER a reasonable thing in C?
It’s not reasonable in any language
it is not
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?
That code is a crime against nature and humanity.
I bet there exist some Linux installs out there with a different shell than ‘bash’,
100%. Alpine is one such distro.
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