bash种如何用变量替代_bash中goto的替代方法

bash种如何用变量替代

As we know:

据我们所知:

  1. There is no goto statement support in bash.

    bash中没有goto语句支持。

  2. 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语句,但是可以实现非常接近的结果。

Answered by Eric Z Ma.
埃里克·马(Eric Z Ma)回答。

翻译自: https://www.systutorials.com/alternatives-to-goto-in-bash/

bash种如何用变量替代

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值