Hacker News new | past | comments | ask | show | jobs | submit login

    #!/bin/bash
    set -eu
    export SHELLOPTS



That doesn't solve the problem that parent incorrectly explained.

    echo "$(false)"
swallows the exit code from $(false).

    $ cat /tmp/test.sh
    set -euvx
    export SHELLOPTS
    echo "$(false)"
    echo "echo of string with failed subcommand does not kill script"
    $(false)
    echo "but consuming exit code does"
        
    $ /tmp/test.sh        
    export SHELLOPTS
    + export SHELLOPTS
    echo "$(false)"
    false
    ++ false
    + echo ''
        
    echo "echo of string with failed subcommand does not kill script"
    + echo 'echo of string with failed subcommand does not kill script'
    echo of string with failed subcommand does not kill script
    $(false)
    false
    ++ false




Consider applying for YC's Summer 2025 batch! Applications are open till May 13

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: