如何在tcsh脚本中回显命令? [英] How can I echo commands in a tcsh script?

查看:316
本文介绍了如何在tcsh脚本中回显命令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是的。我知道我不应该用它来编写脚本。是。这是垃圾我确实是一个傻瓜。

Yes. I know I shouldn't be using it for scripting. Yes. It is rubbish. I am indeed a fool.

然而。

我想看到脚本正在执行的命令,用于调试目的。我想你用bash脚本中的set -x或set -v来获得这个效果。

I'd like to see the commands the script is executing, for debugging purposes. I think you get this effect with set -x or set -v in bash scripts.

所以例如,如果脚本是

#!/bin/tcsh

echo "Hello"

然后当它运行时,我会看到

then when it ran, I'd see

echo "Hello"
Hello


推荐答案

让我们说你的脚本名称是tcsh_file
假设这个文件包括shebang。

Lets say your script name is tcsh_file Lets assume this file includes shebang as well.

现在在终端上运行此命令

now run this command on terminal


tcsh -x tcsh_file

tcsh -x tcsh_file

这将在执行之前打印每一行。它基本上是一种互动的执行模式。

this will print every line before executing it. it's basically an interactive mode of execution.

这是你需要的吗?

这篇关于如何在tcsh脚本中回显命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆