在运行时编辑shell脚本 [英] Edit shell script while it's running

查看:98
本文介绍了在运行时编辑shell脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您可以在运行过程中编辑shell脚本,并使更改影响正在运行的脚本吗?

Can you edit a shell script while it's running and have the changes affect the running script?

我很好奇一个csh脚本的具体情况,我认为该批处理运行着一系列不同的构建风格并整夜运行.如果在操作过程中发生什么事情,我想添加其他命令,或注释掉未执行的命令.

I'm curious about the specific case of a csh script I have that batch runs a bunch of different build flavors and runs all night. If something occurs to me mid operation, I'd like to go in and add additional commands, or comment out un-executed ones.

如果不可能,是否有任何外壳或批处理机制可以使我做到这一点?

If not possible, is there any shell or batch-mechanism that would allow me to do this?

我当然已经尝试过了,但是要知道它是否有效还需要几个小时,而且我对幕后正在发生或未发生的事情感到好奇.

Of course I've tried it, but it will be hours before I see if it worked or not, and I'm curious about what's happening or not happening behind the scenes.

推荐答案

脚本无法正常工作;执行副本独立于您正在编辑的源文件.下次运行脚本时,它将基于源文件的最新保存版本.

Scripts don't work that way; the executing copy is independent from the source file that you are editing. Next time the script is run, it will be based on the most recently saved version of the source file.

明智的做法是将此脚本分成多个文件,然后分别运行它们.这将减少执行失败的时间. (即,将批处理分成一个构建风味脚本,分别运行每个脚本以查看引起问题的脚本).

It might be wise to break out this script into multiple files, and run them individually. This will reduce the execution time to failure. (ie, split the batch into one build flavor scripts, running each one individually to see which one is causing the trouble).

这篇关于在运行时编辑shell脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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