Re: /bin/sh vi mode command line editing and the period

2007-08-29 Thread [EMAIL PROTECTED]@mgedv.net

I wasn't able to reproduce what you explained...maybe I missed something?



i just do the following:

clear
/bin/sh
EDITOR=vi
export EDITOR
set -o $EDITOR
echo 1
echo 2
echo 3
echo 4
ESC-.

and this is the output:
test# /bin/sh
test# EDITOR=vi
export EDITOR
set -o $EDITOR
echo 1
echo 2
echo 3
echo 4
test# test# test# echo 1
1
test# echo 2
2
test# echo 3
3
test# echo 4
4
test#
test#
test# echo 2
2
test# echo 3
3
test# echo 4
4
test#
test#


interestingly, echo 1 is not re-executed but the other commands are.
dunno what's going on here, but i really find it somewhat dangerous
as a default root shell for a unix system (of course, in vi mode)

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: /bin/sh vi mode command line editing and the period

2007-08-29 Thread Bahman M.
 i just do the following:

 clear
 /bin/sh
 EDITOR=vi
 export EDITOR
 set -o $EDITOR
 echo 1
 echo 2
 echo 3
 echo 4
 ESC-.

I tested the command sequence you gave and the result was as you
explained. What caught my attention, however, was that all the
commands were builtin. I tested with non-builtin commands (eg.
/bin/echo instead of echo) and ESC-. did nothing. In fact unless the
last command was a builtin, ESC-. just repeated the last _editing_
action.
This is not a desired behaviour however IMO, to repeat the last
command (if builtin) upon a ESC-. on an empty line.
Please correct me if I'm wrong.

Bahman
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: /bin/sh vi mode command line editing and the period

2007-08-29 Thread [EMAIL PROTECTED]@mgedv.net

i just do the following:

clear
/bin/sh
EDITOR=vi
export EDITOR
set -o $EDITOR
echo 1
echo 2
echo 3
echo 4
ESC-.


I tested the command sequence you gave and the result was as you
explained. What caught my attention, however, was that all the
commands were builtin. I tested with non-builtin commands (eg.
/bin/echo instead of echo) and ESC-. did nothing. In fact unless the
last command was a builtin, ESC-. just repeated the last _editing_
action.
This is not a desired behaviour however IMO, to repeat the last
command (if builtin) upon a ESC-. on an empty line.
Please correct me if I'm wrong.



well, now i did this:
/bin/sh
EDITOR=vi
export EDITOR
set -o $EDITOR
echo 1 foo
echo 2 foo
cat foo foo1
cat foo1 foo
cat foo


with this result:
test# /bin/sh
test# EDITOR=vi
test# export EDITOR
test# set -o $EDITOR
test# echo 1 foo
test# echo 2 foo
test# cat foo foo1
test# cat foo1 foo
test# cat foo
1
2
1
2
test#
test# echo 2 foo
test# cat foo foo1
test# cat foo1 foo
test# cat foo
1
2
1
2
2
1
2
1
2
1
2
2
test#

i took care that foo and foo1 did not exist prior to testing!
but i'm still not sure whether i should file a PR or not.
my assumption and expectance for ESC-. would be:
(regardless whether the input line is empty or not)
- ignore the key completely
- execute the last executed command again (ignoring the content
in the input buffer)

still, it's risky, maybe the command should not get executed but
pasted into the commandline like with ESC-- (minus).
executing should also be fine - if it's just the last command and
not the whole history. this is not a feature - for me it seems to
be much more than senseless.

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: /bin/sh vi mode command line editing and the period

2007-08-28 Thread [EMAIL PROTECTED]@mgedv.net



As far as I know, ESC-. (in fact hitting '.' when in command mode)
repeats your very last action whether it was an editing action or
executing a command.


yes, that's true for vi, but not for /bin/sh in vi-mode. at least
on my 6.2-RELEASE.
;)

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: /bin/sh vi mode command line editing and the period

2007-08-28 Thread Bahman M.
I wasn't able to reproduce what you explained...maybe I missed something?

Bahman

On 8/28/07, [EMAIL PROTECTED]@mgedv.net [EMAIL PROTECTED] wrote:

  As far as I know, ESC-. (in fact hitting '.' when in command mode)
  repeats your very last action whether it was an editing action or
  executing a command.

 yes, that's true for vi, but not for /bin/sh in vi-mode. at least
 on my 6.2-RELEASE.
 ;)

 ___
 freebsd-questions@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to [EMAIL PROTECTED]

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


/bin/sh vi mode command line editing and the period

2007-08-27 Thread [EMAIL PROTECTED]@mgedv.net

hi folks,

when someone uses set -o vi to put /bin/sh into vi-mode
for command line editing, he for example could use the
ESC-minus sequence for editing the last executed command.

but there's another bug/feature: ESC-. (period).
when i (of course by mistake) hit this feature,
all commands in the history IMMEDIATELY get executed
without even pressing enter.

is this a bug or a feature and how can i avoid this
to happen - even with being in vi mode and in /bin/sh.

from my point of view, this is a really dangerous thing,
because commands like rm -rf or kill could easily get
executed when they shouldn't!

the documentation for vi shows that . should be used
to edit the whole history and not to parse and execute it!
(allocated to cmdline editing).

cu / regards

ps: just reply to the list, i'm on it.

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: /bin/sh vi mode command line editing and the period

2007-08-27 Thread Bahman M.
As far as I know, ESC-. (in fact hitting '.' when in command mode)
repeats your very last action whether it was an editing action or
executing a command.

Bahman

On 8/27/07, [EMAIL PROTECTED]@mgedv.net [EMAIL PROTECTED] wrote:
 hi folks,

 when someone uses set -o vi to put /bin/sh into vi-mode
 for command line editing, he for example could use the
 ESC-minus sequence for editing the last executed command.

 but there's another bug/feature: ESC-. (period).
 when i (of course by mistake) hit this feature,
 all commands in the history IMMEDIATELY get executed
 without even pressing enter.

 is this a bug or a feature and how can i avoid this
 to happen - even with being in vi mode and in /bin/sh.

 from my point of view, this is a really dangerous thing,
 because commands like rm -rf or kill could easily get
 executed when they shouldn't!

 the documentation for vi shows that . should be used
 to edit the whole history and not to parse and execute it!
 (allocated to cmdline editing).

 cu / regards

 ps: just reply to the list, i'm on it.

 ___
 freebsd-questions@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to [EMAIL PROTECTED]

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]