Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Feed a command-line shell from another shell

This question may sound weird but I'll explain the context and hopefully it will justify it. I'm on Linux trying to work with some ill-made shells.

I have to work with fdb and fcsh, which are Adobe's commandline debugger and compiler shells for Flash. This isn't particularly relevant - only the fact that they're shells, i.e. you run fdb, it gives you a prompt like (fdb) and you type commands. All cool.

BUT. Say you want to re-execute your last command, so you hit [Arrow-Up] on your keyboard, like you'd do in Bash, Python Shell, GDB shell etc. And it doesn't work. Instead of seeing the last command at the prompt, I see (fdb) ^[[A (note that (fdb) is the prompt). Pressing the [Arrow-Left] key to go back a few characters and fix your typed command - same story.

This looks like Adobe didn't make its shells very well. Is there a way to open a simple bash shell (or something) that will keep feeding my commands to an open fdb shell, kept as a daemon? I hope that this way I get Bash's neat usability features for handling commands, but get them executed by fdb.

Note: I have found this wrapper which keeps fcsh daemonized and holds it's pid file, I think. This is cool. I haven't used it yet, but considering it. Still, my question holds: is there a way to pipe commands from one shell to another?

like image 511
CamilB Avatar asked Feb 21 '23 17:02

CamilB


1 Answers

Bash uses GNU readline library which can be used only for open source programs (with an appropriate license). But you can use rlwrap. It is in most Linux distributives. You can use it as rlwrap fdb, for example.

like image 117
yazu Avatar answered Feb 27 '23 23:02

yazu