[Tcsh] Further issues with jobcmd

Jamie Landeg-Jones jamie at catflap.org
Sat Jan 2 00:26:12 UTC 2021


"Eduardo Alvarez" <ealvarez at fastmail.com> wrote:

> Hello, list,
>
> Last year, I reported an issues with jobcmd and ls (see "[Tcsh] ls prints 0m if xterm title is set via jobcmd" from September 18). I recently decided to revisit this configuration, using ls-F as a substitute, and in the process of testing I found another bit of odd behavior.
>
> Where it happens: I've seen this take place on Xterm and rxvt-unicode. No further tests have been conducted.
>
> How to reproduce:
>
> 1. Alias jobcmd as follows. Again, note the un-escaped semicolon, which is necessary for this to work correctly:
>
>     alias jobcmd 'echo -n "\033]2;\!#:q\007"'
>
> 2. Run any command that uses an argument. I used "man man",  "vim foo", and "ls /etc" as tests.
> 3. If it's a full-screen program (such as vim or man), close the app.
> 4. Press up arrow or CTRL-P to invoke up-history.

>
> What should happen:
>
> The history mechanism should put the last command executed, complete with its arguments (eg, man man).
>
> What happens:
>
> The history mechanism prints only the command, without arguments. If up-history is invoked again, however, then the command + argument is displayed.
>
> Oddly enough, executing "history" only shows the command and its arguments, there isn't a listing in history with just the command.
>
> Thanks in advance for the help,

In my tcshrc, I have a piece of code in "postcmd" that sets a variable "this_command". I hit the
same problem a while back. My tcshrc currently contains:

## _____________________________________________________________________________________________________
## NB: In the following command, instead of the snippet:   set this_command="`history -h 1`";
##     , we should have been able to use:                  set this_command='"'"'\!#:0:q \!#:*:q'"'"';
##
##     However, this produces a bug that messes up the interactive session history
##     (in particular, using up-arrow to move backwards in history)
## _____________________________________________________________________________________________________
##

I don't have a fix, but does the workaround I used above work for you?

Cheers
   Jamie


More information about the Tcsh mailing list