From ec2aa8a178ead110f2b35772f35c8588772f96fb Mon Sep 17 00:00:00 2001 From: Emanuele Torre Date: Wed, 1 Jun 2022 17:52:05 +0200 Subject: [PATCH] Revert 55f3a67941caac78dbdbd7b324e3d5503b1a2672...40f5ce0eee45f4ecc27232d838e0cb05383708f7 on SC3043 --- SC3043.md | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/SC3043.md b/SC3043.md index 5ab5e8a..6882915 100644 --- a/SC3043.md +++ b/SC3043.md @@ -20,29 +20,6 @@ myfunc() { } ``` -You can also `unset` the variable at the end of the function:1 - -```sh -myfunc() { - i=0 - .. - unset i -} -``` - -You can also use POSIX’s `set +a` or `set +o allexport` which prevents the -“export attribute” from being “set for each variable to which an -assignment is performed”:2 - -```sh -myfunc() { - set +a || set +o allexport # either will work – don’t use both. - i=0 - .. - set -a || set -o allexport # optionally undo `set` modifications -} -``` - ### Rationale: `local` is supported in many shells, including bash, ksh, dash, and BusyBox ash. However, strictly speaking, it's not POSIX. @@ -52,8 +29,5 @@ myfunc() { Since quite a lot of real world shells support this feature, you may decide to [[ignore]] the warning. ### Related resources: -1. [Shell Command Language § `unset`](https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#unset) ([archived](https://web.archive.org/web/20180326004734/https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#unset)) -2. [Shell Command Language § Description](https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_25_03) ([archived](https://web.archive.org/web/20180326004734/https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_25_03)) - * Help by adding links to BashFAQ, StackOverflow, man pages, POSIX, etc!