How can I echo commands in a tcsh script?

吃可爱长大的小学妹 提交于 2019-11-27 17:27:19

问题


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

Nevertheless.

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.

So e.g., if the script were

#!/bin/tcsh

echo "Hello"

then when it ran, I'd see

echo "Hello"
Hello

回答1:


Put:

set echo and/or set verbose

at the top of your script. That will print out everything that happens in your script and are equivalent to the bash set -x and set -v commands.




回答2:


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

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

Is this what you needed?



来源:https://stackoverflow.com/questions/9095175/how-can-i-echo-commands-in-a-tcsh-script

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!