Skip to content

Instantly share code, notes, and snippets.

@wjt
Created September 22, 2017 07:54
Show Gist options
  • Save wjt/2bcb4a9705db683c8d8292e3cc4ac9d3 to your computer and use it in GitHub Desktop.
Save wjt/2bcb4a9705db683c8d8292e3cc4ac9d3 to your computer and use it in GitHub Desktop.
#!/bin/bash -ex
f() {
local x=$(echo oh no; false)
echo "f: $x"
}
g() {
local y
y=$(echo oh no; false)
echo "g: $y"
}
f
g
+ f
++ echo oh no
++ false
+ local 'x=oh no'
+ echo 'f: oh no'
f: oh no
+ g
+ local y
++ echo oh no
++ false
+ y='oh no'
In declare-and-assign.sh line 3:
local x=$(echo oh no; false)
^-- SC2155: Declare and assign separately to avoid masking return values.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment