do_install() fails because it tries to write to the root directory.
At least on my system, it is not possible to locally set an environment variable on the command line calling a Bash function (like do_install() does). Example:
#!/bin/sh
a() {
sh -c 'echo bar=\"$bar\"'
}
b() {
sh -c 'echo baz=\"$baz\"'
}
foo=123 sh -c 'echo foo=\"$foo\"'
bar=456 a
export baz=789
b
$SHELL --version | head -1
Output:
foo="123"
bar=""
baz="789"
GNU bash, version 4.2.37(1)-release (x86_64-pc-linux-gnu)
So setting a variable locally before calling a "real" command works (foo) and setting a variable globally before calling a function works (baz). But setting a variable locally before calling a function fails (bar).
do_install()
fails because it tries to write to the root directory.At least on my system, it is not possible to locally set an environment variable on the command line calling a Bash function (like
do_install()
does). Example:Output:
So setting a variable locally before calling a "real" command works (
foo
) and setting a variable globally before calling a function works (baz
). But setting a variable locally before calling a function fails (bar
).