Hu wrote:What is the point of this? If you want the shell to go away, just exec "$@". Using eval is usually wrong. Using CMD && exit || exit looks unnecessarily complex. If you do not want to exec, you could use ; exit instead of the && || combination.
That was a mistake I wrote this from memory, here is the correct one
Code: Select all
trap 'exit' INT
eval "$@ && exit || exit " || exit
It is just excessive fail-safes,I do not have the leniency to stand around my portable device when emerging and for work and living environment related reasons/being around mischievous individuals having my device open is a reason to format and go again, I won't ever leave a xorg server open in these cases but rather use a tty, if I am using the device actively ill just "emerge -xyz @world", if however I have to leave the presence of my device I run ", emerge -xyz @world", simply if emerge fails then exit, if emerge succeeds exit, if exit fails. . . exit, worse case scenario if there was a "cancel exit command" vulnerability someone could take advantage of by spamming ctrl+c or ctrl+z it wourld still exit because of trap
edit: as far as I remember i put the last || exit after the quotes to catch ctrl+z actions, thinking about it I could probably trap these as well,eh food for thought
edit2: just checked online, trapping ctrl+z is more like ctrl+Zombies since the script will never die, dunno if it was why i did so with || exit or not