Mikael Berthe is a user on mamot.fr. You can follow them or interact with them if you have an account anywhere in the fediverse. If you don't, you can sign up here.

#bash stumper: if you're performing input via stdin (e.g. `cat -`), how the heck do you get #vi mode to work or otherwise have any control over editing?
#commandline #cli #editor

@kemonine i don't want to add to the command line. i'm already in stdin. i can edit a command line easy with vi mode. but being in stdin is the issue.

@wxl Not sure exactly what your use case is, but you might have a look at vipe(1) if you don't know about it. It's in the moreutils package on my system.

command1 | vipe | command2
» vipe allows you to run your editor in the middle of a unix pipeline and edit the data that is being piped between programs.

@kemonine

@McKael @kemonine that's a really cool program I did not know about, but not what I'm looking for.

Imagine you have already executed `cat -`. You're now in stdin. Let's say you want to edit your input before EOF. How does one do that?

Mikael Berthe @McKael

@wxl @kemonine I don't think you can, since stdin is usually a stream. I guess you shouldn't use cat in the first place... :)

If you just want to edit a text and stream it to the standard input of a command, maybe you can use something like Vim (and use ":w !command") ?