Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #16805
| From | Martijn Dekker <martijn@inlv.org> |
|---|---|
| Newsgroups | gnu.bash.bug |
| Subject | Re: How to use PROMPT_COMMAND(S) without breaking other scripts |
| Date | 2020-08-24 20:53 +0100 |
| Message-ID | <mailman.1059.1598298832.2469.bug-bash@gnu.org> (permalink) |
| References | (2 earlier) <CAFLRLk9vNPM5NtypB2UNcDqMZfG3Lmi3zEMGfPqZNacmHCoAoA@mail.gmail.com> <0c10b76f-a7f0-1c52-77b7-4b208035956b@case.edu> <c904f5b5-1312-ac4c-26bd-bfb97c1f43e8@inlv.org> <669a0539-fd4f-b4f9-f4c5-06922fb670d0@case.edu> <fa6b2bac-5bcd-1cce-94af-0be4aff02cbf@inlv.org> |
Op 24-08-20 om 20:37 schreef Chet Ramey:
> On 8/24/20 12:58 PM, Martijn Dekker wrote:
>> Op 24-08-20 om 15:57 schreef Chet Ramey:
>>> I sometimes think I should have stuck with converting PROMPT_COMMAND to
>>> an array. Either way, there's going to be a transition, and maybe that
>>> would have been the easiest.
>>
>> Is it too late? I think that would actually be cleaner than adding a
>> separate array, per Koichi's report.
>
> We're not "adding" anything. Bash just looks for this variable and reacts
> if it finds it. It's not a special variable, and bash doesn't create it if
> it doesn't exist.
So now you're adding code that looks for an array. Which is something
other than nothing.
Granted, my language wasn't very precise, but I'm fairly confident that
my intent was understandable.
> What I mean is looking for PROMPT_COMMAND as happens now, and reacting a
> different way if it's an array variable. That would resolve the existing
> assignment issues, but open up the separate issues you describe.
But I also suggested a way of avoiding those issues: initialise
$PROMPT_COMMAND a.k.a. ${PROMPT_COMMAND[0]} as empty.
- M.
--
|| modernish -- harness the shell
|| https://github.com/modernish/modernish
||
|| KornShell lives!
|| https://github.com/ksh93/ksh
Back to gnu.bash.bug | Previous | Next | Find similar
Re: How to use PROMPT_COMMAND(S) without breaking other scripts Martijn Dekker <martijn@inlv.org> - 2020-08-24 20:53 +0100
csiph-web