[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Very Unexpected response from command 'set'
From: |
Robert Elz |
Subject: |
Re: Very Unexpected response from command 'set' |
Date: |
Sun, 15 Dec 2024 22:35:37 +0700 |
Date: Sat, 14 Dec 2024 19:21:50 -0500
From: Greg Wooledge <greg@wooledge.org>
Message-ID: <20241215002150.GC30016@wooledge.org>
| The output of "set" includes more than just variables. It also includes
| shell functions.
But that's a clear standards violation - but to be clear, if posix mode
is turned on in bash, only the variables are output. It could be perhaps
argued that including the functions is just an extension, but it isn't, as
the standard also specifies the format to be used for the output, and the way
functions are (effectively must be) output isn't in the required format.
| If you ONLY want to see variables, you can use 'declare -p' instead.
Or just turn on posix mode, which most of the time is a good idea anyway
(and will be better once bash eventually stops enforcing "name" rules for
function names in posix mode, which posix never required, and in the
current version, is quite explicit about). (nb: posix does require
conforming applications to only use "name"s as function names, but that
is quite a different thing.)
kre