2 added 2 characters in body
source | link

Because detecting useless cat is really really hard.

I had a shell script where I wrote

cat | (somecommnadsomecommand <<!
...
/proc/self/fd/3
...
!) 0<&3

The shell script failed in production if the catcat was removed because it was invoked via su -c 'script.sh' someuser. The apparently supliferoussuperfluous cat caused the owner of standard input to change to the user the script was running as so that reopening it via /proc worked.

Because detecting useless cat is really really hard.

I had a shell script where I wrote

cat | (somecommnad <<!
...
/proc/self/fd/3
...
!) 0<&3

The shell script failed in production if the cat was removed because it was invoked via su -c 'script.sh' someuser. The apparently supliferous cat caused the owner of standard input to change to the user the script was running as so that reopening it via /proc worked.

Because detecting useless cat is really really hard.

I had a shell script where I wrote

cat | (somecommand <<!
...
/proc/self/fd/3
...
!) 0<&3

The shell script failed in production if the cat was removed because it was invoked via su -c 'script.sh' someuser. The apparently superfluous cat caused the owner of standard input to change to the user the script was running as so that reopening it via /proc worked.

1
source | link

Because detecting useless cat is really really hard.

I had a shell script where I wrote

cat | (somecommnad <<!
...
/proc/self/fd/3
...
!) 0<&3

The shell script failed in production if the cat was removed because it was invoked via su -c 'script.sh' someuser. The apparently supliferous cat caused the owner of standard input to change to the user the script was running as so that reopening it via /proc worked.