是否有优势,使用bash在Perl或Python的? [英] Is there an advantage to using Bash over Perl or Python?

查看:189
本文介绍了是否有优势,使用bash在Perl或Python的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿,我一直在使用Linux的一段时间,认为这是一次终于潜入shell脚本。

Hey I've been using Linux for a while and thought it was time to finally dive into shell scripting.

问题是,我没能找到使用bash过像Perl或Python的任何显著的优势。是否有任何两者之间的性能或功耗的差异?我想弄清楚的Python / Perl的会更适合作为远力量和效率会。

The problem is I've failed to find any significant advantage of using Bash over something like Perl or Python. Are there any performance or power differences between the two? I'd figure Python/Perl would be more well suited as far as power and efficiency goes.

推荐答案

两个优势浮现在脑海中:

Two advantages come to mind:


  • 简单:直接访问所有美好的Linux工具厕所 LS 的grep SED ...等。
    为什么要不断地使用Python的模块?

  • 我越来越喜欢使用 GNU并行,与可以并行执行你的bash脚本。例如。从该名男子页,批量并行创建目录下的所有JPG文件的竖起大拇指:

  • Simplicity: direct access to all wonderful linux tools wc, ls, cat, grep, sed... etc. Why constantly use python's subprocess module?
  • I'm increasingly fond of using gnu parallel, with which you can execute your bash scripts in parallel. E.g. from the man page, batch create thumbs of all jpgs in directory in parallel:

LS * .JPG |并行转换-geometry 120 {}拇指_ {}

顺便说一句,我通常在我的bash脚本一些Python调用(例如,用于绘制)。使用什么是最适合的任务!

By the way, I usually have some python calls in my bash scripts (e.g. for plotting). Use whatever is best for the task!

这篇关于是否有优势,使用bash在Perl或Python的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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