tcsh:我们如何在历史记录中显示 foreach 循环的主体

tcsh:我们如何在历史记录中显示 foreach 循环的主体

我发现历史记录不显示循环主体。有办法显示它们吗?

san: cd /tmp/test
san: touch abc
san: touch def
san: ls
abc   def
san: foreach file ( `ls` )
foreach? echo "File is $file"
foreach? end
File is abc
File is def
san: history | tail -6
   509  9:49    cd /tmp/test
   510  9:49    touch abc
   511  9:49    touch def
   512  9:49    ls
   513  9:49    foreach file ( `ls` )
   514  9:50    history | tail -6

历史记录不显示命令echo "File is $file"

更新:

新版本已解决这个问题,请参阅 Steve Parker 的回答

> mkdir /tmp/test
> cd /tmp/test
> touch abc
> touch def
> ls
abc  def
> foreach file (`ls`)
foreach? echo "File is $file"
foreach? end
File is abc
File is def
> history | tail -6
    55  13:09   touch def
    56  13:09   ls
    57  13:09   foreach file ( `ls` )
    58  13:09   echo "File is $file"
    59  13:09   end
    60  13:09   history | tail -6
> tcsh --version
tcsh 6.18.01 (Astron) 2012-02-14 (x86_64-unknown-linux)

答案1

此功能在 tcsh 17.01 版中出现,因此我的 tcsh:propmt> tcsh --version tcsh 6.17.00 (Astron) 2009-07-10 (x86_64-unknown-linux) options wide,nls,dl,al,kan,sm,rh,color,filec

不允许这样做,但是下一个版本将支持它。

https://github.com/tcsh-org/tcsh/compare/TCSH6_17_00...TCSH6_17_01<- 查看“文件更改”选项卡并查看 tcsh.man 文件底部的第 5019 行。

相关内容