r/bash • u/Louis_creates • 17d ago
critique am I using pkexec properly in this script?
/r/linuxquestions/comments/1xrtrff/am_i_useing_pkexec_properly_in_this_script/
1
Upvotes
r/bash • u/Louis_creates • 17d ago
1
u/bac0on 16d ago edited 15d ago
Just a small pointer — you presume that if
status_checkisn't1, it has to be0...Instead, you could sanitize status_check and use an array. That would get rid of the if-then statement altogether:
You can flip the "bit" much in the same way:
$((t ^= 1))or$((t = !t))It's almost better to use specifiers in the format argument.
\evaluates in double quotes, which will break your newline, so"Turn $option\nReturn"becomes"Turn \\nReturn"if ever$optioncontain a\.