Whenever I try to use the arrow keys in the
at> prompt (after, for example, running
at now) it just shows control codes, eg.
^[[D for ←.
This makes pasting and editing long commands difficult as the only viable option is to edit, copy and paste from a separate document.
So, how do I get arrow keys to work in the
(Googling for anything having to do with the
at> prompt or
/usr/bin/at is quite difficult…)
Here is Solutions:
We have many solutions to this problem, But we recommend you to use the first solution because it is tested & true solution that will 100% work for you.
You could use a program such as rlwrap (readline wrapper) for this:
rlwrap at now
* HOW TO USE IT: If $ <command> <args> doesn't let you use arrow keys to edit input, or if you just want decent input history and completion, try: $ rlwrap [-options] <command> <args>
at now << EOF commands ︙ EOF
You’ll be able to do readline-like editing while you’re typing the commands.
rlwrap is one such tool for doing this. It employs the GNU Readline library.
It was written in 1999, the same year that Per Bothner wrote
rlfe, a similar tool that is now bundled with GNU Readline as an example program. Debian builds the example, tacks on a Debian-only manual page and packages them in the rlfe package.
GNU Readline is not the only line editing library around. But I do not know of any similar wrapper tools that employ editline/libedit.
Of course, if you are using the “here document” idea from another answer, you may well be using another editing library. If your shell is the Z shell you will be editing the “here document” using ZLE, for example.
Note: Use and implement solution 1 because this method fully tested our system.
Thank you 🙂