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

查看:42
本文介绍了在运行时编辑 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天全站免登陆