Forums: ヘルプ (Thread #48912)

How to "unflatten" the history? (2023-03-26 23:25 by Dave #94746)

Hello all.

I am trying to figure out how to properly (read: "POSIXLY") un-flatten the shell history.
With "set -o vi", and a shell fc / history behaving as expected, I can enter something like this (as a dumb example):

$ ex -s <<EOF
> r!set -o
> %s/\<on\>/ON/g
> %p
> q!
> EOF
...
then
$ fc -l 1

will show something like this:
6 ex -s <<EOF
r!set -o
%s/\<on\>/ON/g
%p
q!
EOF

I can then recall that line and use <ESC>v to edit and re-execute that whole "one-liner", per POSIX.
$ ex -s <<EOF^Jr!set -o^J%s/\<on\>/ON/g^J%p^Jq!^JEOF

However, with yash:
$ ex -s <<EOF
> r!set -o
> %s/\<on\>/ON/g
> %p
> q!
> EOF
...

$ fc -l 1
1 ex -s <<EOF
2 r!set -o
3 %s/\<on\>/ON/g
4 %p
5 q!
6 EOF
7 fc -l 1

Everything is "flat", on separate lines.

Is there a way to get the expected behavior with yash?

Thanks

Reply to #94746×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Login