3

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 at> prompt?

(Googling for anything having to do with the at> prompt or /usr/bin/at is quite difficult…)

9

You could use a program such as rlwrap (readline wrapper) for this:

rlwrap at now

Further reading:

  • hanslub42/rlwrap (github)

    * 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>
    
| improve this answer | |
2

Do

at now << EOF
  commands
     ︙
EOF

You'll be able to do readline-like editing while you're typing the commands.

| improve this answer | |
1

Hans Lub's 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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.