将 Bash 脚本转换为 Shell [英] Convert Bash Scripts To Shell

查看:96
本文介绍了将 Bash 脚本转换为 Shell的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用 Bash 编写的脚本列表,现在我需要将它们转换为 Shell 脚本.我知道 bash 是 Shell 规范的扩展实现,因此,我正在寻找在 Bash 中实现的扩展的一些规范,即 Bash 中不属于 Shell 规范的内容,因此我可以查看我的脚本并进行适当的修改.有这样的文件吗?或者,我们将不胜感激关于如何进行转换的任何其他建议.

I have a list of scripts written in Bash, and now i need to convert them to Shell scripts. I know bash is an extended implementation of the Shell specification, and so, i'm looking for some specification of the extension implemented in Bash, namely, what's in Bash that is not part of the Shell specification, so i could go over my scripts and make the appropriate modification. Is there such a document? Alternatively, any other suggestion on how to do the conversion will be greatly appreciated.

推荐答案

将 Bash 脚本更改为 POSIX 兼容 shell 代码,您必须删除任何 bashisms.虽然我认为没有任何工具可以可靠地处理所有 bashisms,但您可以从 checkbashisms.

To change Bash scripts to POSIX compatible shell code you have to remove any bashisms. While I don't think there is any tool out there that can reliably handle all bashisms you can start with checkbashisms.

这篇关于将 Bash 脚本转换为 Shell的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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