
shell 的不少工作都能由 Python 来代替(个人愚见。。),那么在日常开发中,在 linux 下能完全用 Python 代替 shell 编程吗?请各位大佬来打击我的说法,让菜鸟开阔一下眼界。
1 Finest 2017 年 4 月 24 日 可以 |
2 superPershing OP @hand515 那是不是说在某种程度上没有学 shell 的必要了? |
3 jtsai 2017 年 4 月 24 日 @superPershing 学 shell 是学 shell 的思想,怎么跟 liunx 打交道。不学 shell 你也不知道怎么用 Python 跟 linux 打交道 |
4 holyghost 2017 年 4 月 24 日 |
5 BOYPT 2017 年 4 月 24 日 (这就是你不学习 shell 的借口嘛! |
6 FunctionOne 2017 年 4 月 24 日 #! /usr/bin/env python 这个…… |
7 FunctionOne 2017 年 4 月 24 日 这个谁来解释呢? |
8 SuperMild 2017 年 4 月 24 日 不仅 Python ,甚至用 Java 都可以,有人这样做了: https://www.teamten.com/lawrence/writings/java-for-everything.html |
9 bozong 2017 年 4 月 24 日 |
10 Finest 2017 年 4 月 24 日 |
12 jinghangdayunhe 2017 年 4 月 24 日 @bozong 啥好东西? |
13 imn1 2017 年 4 月 24 日 “完全”是不能的,除非你想降低效率 例如 cat text.txt 或 ls ../*.txt python 如何提高效率 |
14 tammy 2017 年 4 月 24 日 我想说 python shell 也是 shell 啊,楼主你说的是 posix shell? |
16 kmyzzy 2017 年 4 月 24 日 试试 xonsh ,支持 shell 命令,也支持 python 语法 |
18 lucifer9 2017 年 4 月 24 日 绝对可以吧,如果有不行的,请呼叫 os.system |
19 geelaw 2017 年 4 月 24 日 这俩玩意儿难道不是平凡地互相归约么?互相调用并不困难吧 |
20 dacapoday 2017 年 4 月 24 日 更完善的说是用 ipython 代替 shell ,而且 ipython 中 !开头的语句当做 shell 执行,从而兼顾 shell 便利和 python 的强大。 |
21 CQCQCQ 2017 年 4 月 24 日 via iPhone 集多不压身!我就想问一下大家三个字母的 top 快还是 import os.system xxxxx 快? |
22 fisher335 2017 年 4 月 24 日 via iPhone 你用 python 这个 netstat 命令嘛! |
23 mingyun 2017 年 4 月 24 日 crontab 怎么替代 |
24 privil 2017 年 4 月 25 日 via iPhone 让 shell 的归 shell , python 的归 python 。这样或许是极好的 |
25 mN71eOOprFyMsnPx 2017 年 4 月 25 日 Python 完全代替 Shell 脚本是没问题的。 但是, Python 不能代替日常使用的 Shell 命令。 这点要搞清楚。一定要记住,别用 Shell 命令写较长的脚本就是。 |