Documentation Error

2022-06-08 Thread mcmuffin6o
In section 3.5.3 Shell Parameter Expansion:

In the sixth paragraph it correctly states that "Bash tests for a parameter
that is unset *or* null" when you use the colon. It later attempts to
restate this but fails by saying "if the colon is included, the operator
tests for both parameter's existence *and* that its value is not null"

This caused me quite some consternation, but only for about a minute. Not
an emergency to fix, but would be best if it was fixed at some point,
especially since it should be easy.

Hope I helped!

-mcmuffin6o


Re: Documentation Error

2022-06-08 Thread G. Branden Robinson
At 2022-06-08T12:05:06-0500, mcmuffin6o wrote:
> In section 3.5.3 Shell Parameter Expansion:
> 
> In the sixth paragraph it correctly states that "Bash tests for a
> parameter that is unset *or* null" when you use the colon. It later
> attempts to restate this but fails by saying "if the colon is
> included, the operator tests for both parameter's existence *and* that
> its value is not null"

This is an application of DeMorgan's Law to English prose.  I will
translate the clauses into pseudo-C.

"Bash tests for a parameter that is unset *or* null"

if ((!set) || (!has_content))

"the operator tests for both parameter's existence *and* that its value
is not null"

if (set && has_content)

Regards,
Branden


signature.asc
Description: PGP signature


Inconsistency between fc and C-x C-e

2022-06-08 Thread Luciano
Hi!
I had the terrible idea to set my EDITOR variable to something too
complex. I had to pass some options with whitespace to vim, so i decided
to use `eval`. I managed to get something working, but the way the
EDITOR variable is interpreted isn't consistent 
to provide an example, if one sets EDITOR in .bashrc to: 
EDITOR="eval vim --cmd \" set statusline=HI-FROM-\\\$EDITOR laststatus=2  \" -- 
 "
then doing 'fc' works fine, (I get the "HI-FROM-$EDITOR" message on the
status line"), but C-x C-e seems to wipe out the ' \" ' arguments altogether,
leaving eval with only loose words after '--cmd'.
C-x C-e seems to have an extra pass with character escaping, doubling
every \ character makes C-x C-e work as intended, but now fc doesn't
work anymore!
By the way, fc seems to be the one that works as intended, because
programs such as pass interpret the $EDITOR variable the same way as fc
does.
This is clearly not a very important bug, I know! 
Greetings. Luciano




Re: Inconsistency between fc and C-x C-e

2022-06-08 Thread Greg Wooledge
On Wed, Jun 08, 2022 at 06:06:51PM -0300, Luciano wrote:
> I had the terrible idea to set my EDITOR variable to something too
> complex. I had to pass some options with whitespace to vim, so i decided
> to use `eval`. [...]

You could create a wrapper script, put it in your $HOME/bin/ directory
(and make sure that's in PATH), and then set EDITOR to that wrapper.
That should be much more reliable, especially if other programs also
use $EDITOR (which they might).