#kisslinux

Unnofficial KISS Linux community channel | https://kisscommunity.bvnf.space | post logs or else | song of the day https://vid.puffyan.us/H7PvgY65OxA
Earlier messages
pbsds8joined
pbsdsquit (Ping timeout: 268 seconds)
pbsds8changed nick to pbsds
<testuser[m]>phoebos:
<testuser[m]>why does this work https://termbin.com/tgsh
<testuser[m]>but not this https://termbin.com/m57h
yamchah2quit (Remote host closed the connection)
seregjoined
yamchah2joined
seregquit (Max SendQ exceeded)
seregjoined
<wael[m]>https://termbin.com/elf71
<testuser[m]>the problem happens when u short circuit the outermost subshell
<wael[m]>i believe it happens since there is `||` at the end of the recent subshell the outermost subshell's error is ignored
<wael[m]>since `-e` flag is set
<testuser[m]>but the code after || doesnt even get executed
<testuser[m]>for some reason
<testuser[m]>it should
<wael[m]>https://termbin.com/m57h ?
<testuser[m]>exit 1 isnt executed
<wael[m]>because it exits on error without an error handler
<testuser[m]>it doesnt cuz the lowermost unreachable is printed
<testuser[m]>https://termbin.com/whlm
<testuser[m]>see
<testuser[m]>this is with set -eu
<wael[m]>the last command in the list hasnt returned with non-zero
<wael[m]>so its seen as 'non-error' since its subshell
<testuser[m]>hmmmmmmmm
<testuser[m]>WTF
<testuser[m]>WTF
<wael[m]>?
<testuser[m]>nothing
<testuser[m]>the behaviour doesntmake sense
<testuser[m]>but its true
<wael[m]>try it with symbol { }
<phoebos>set -e and || don't play well together
<phoebos>https://unix.stackexchange.com/questions/65532/why-does-set-e-not-work-inside-subshells-with-parenthesis-followed-by-an-or/65564#65564
<phoebos>i don't understand it tbh
<testuser[m]>SO BAD
<wael[m]>wtf
<wael[m]>last time i seen shell scripting be confusing is when i got seg fault
<testuser[m]>well i just added || return $? after all the sub-subshells
<testuser[m]>seems to work
<phoebos>i'm not sure why the exit doesn't run but the false doesn't cause it to exit because it's in an AND-OR list
<phoebos>ie. a command failing is always permitted in that context
<phoebos>so the false is permitted
<phoebos>then the second echo is run
<phoebos>which is successful, so the exit 1 doesn't run
<phoebos>get rid of echo unreachable and exit 1 runs
rohanquit (Ping timeout: 265 seconds)
Later messages