bash种如何用变量替代
As we know:
据我们所知:
There is no
goto
statement support in bash.bash中没有
goto
语句支持。goto
is useful for certain situations, especially for debugging.goto
在某些情况下很有用,尤其是在调试时。
So, is there any alternative mechanisms to goto in bash?
那么,在bash中是否有其他替代机制?
Robert Copeland gave an interesting hacking to this problem: http://bobcopeland.com/blog/2012/10/goto-in-bash/
罗伯特·科普兰(Robert Copeland)对这个问题进行了有趣的修改: http : //bobcopeland.com/blog/2012/10/goto-in-bash/
The idea is like the self-modifying code. But the difference is to generate a piece of the script and eval
(run) it. This is not exactly the goto
statement, but achieve the very close results.
这个想法就像自我修改代码 。 但是不同之处在于生成了一部分脚本并eval
(运行)它。 这不完全是goto
语句,但是可以实现非常接近的结果。
翻译自: https://www.systutorials.com/alternatives-to-goto-in-bash/
bash种如何用变量替代