vgijssel / setup

Workstation and server setup
MIT License
8 stars 0 forks source link

fix: Make command substitution actually fail #623

Closed mvgijssel closed 7 months ago

mvgijssel commented 7 months ago

ref #451

From this article https://stackoverflow.com/questions/20157938/exit-code-of-variable-assignment-to-command-substitution-in-bash learned that a command within a command substitution in bash actually doesn't fail if you store the value in a variable with export ... prefixed 🤦

~/Development/setup mg/451/fix-provisioner-deploy-part-7*
(devbox) nix-shell-env ❯ export KERK=$(exit 1); echo $? 
0

~/Development/setup mg/451/fix-provisioner-deploy-part-7*
(devbox) nix-shell-env ❯ KERK=$(exit 1); echo $?  
1

This caused a whole bunch of unexpected behaviour I now finally get 😅