6 Jan 2024 |
TwilightBlood#4432 | that's valid bash | 18:06:25 |
TwilightBlood#4432 | and any loop, conditional, or grouping commands are valid for that ending | 18:07:59 |
TwilightBlood#4432 | the most common is that last one which the most common of that is {} | 18:08:13 |
vigress7 | So why does this result in no output? How does inheritance work here
function bar() {
export foo=5
}
function baz() {
echo $foo
}
baz | 18:11:17 |
vigress7 | Oh sorry | 18:11:27 |
TwilightBlood#4432 | you never call bar | 18:11:31 |
vigress7 | Yes brainfart | 18:11:37 |
TwilightBlood#4432 | if you did:
bar
baz | 18:11:49 |
TwilightBlood#4432 | it would work | 18:11:50 |
TwilightBlood#4432 | or hell even if you didn't have export in front | 18:12:07 |
TwilightBlood#4432 | the only reason to use export is to make it available to sub-processes | 18:12:30 |
TwilightBlood#4432 | function bar() {
export foo=5
}
function baz() (
echo $foo
)
bar
baz | 18:12:59 |
vigress7 | Then why, when I edit the pacscript to export mod_dir in package() , does post_install() not inherit mod_dir ? | 18:13:02 |
TwilightBlood#4432 | that would workj | 18:13:03 |
TwilightBlood#4432 | * that would work | 18:13:05 |
TwilightBlood#4432 | hm | 18:14:49 |
vigress7 | ~> ll /usr/bin/prettier
lrwxrwxrwx 1 root root 18 Jan 6 21:58 /usr/bin/prettier -> //bin/prettier.cjs | 18:15:11 |
TwilightBlood#4432 | OH | 18:15:35 |
TwilightBlood#4432 | I know why | 18:15:40 |
TwilightBlood#4432 | ok so how we handle postscripts is like this: | 18:15:59 |
TwilightBlood#4432 | <pacscript pasted here>
<postscript function call here> | 18:16:17 |
TwilightBlood#4432 | even though it's "exported", this is a new run of the script so it won't call it | 18:16:32 |
TwilightBlood#4432 | like this | 18:16:39 |
vigress7 | I'll define it outside of the functions then | 18:17:23 |
TwilightBlood#4432 | yeah that would work | 18:17:28 |
vigress7 | Aight, it works | 18:25:20 |
vigress7 | Thanks for the lecture, that filled in some gaps in my knowledge | 18:26:11 |
TwilightBlood#4432 | yeah most of the time you'll use:
foo() {} local foo=bar | 18:36:34 |
7 Jan 2024 |
TwilightBlood#4432 | godbolt.org | 02:51:06 |
alwindoss | How do you generate this? | 02:51:08 |