• 请不要在回答技术问题时复制粘贴 AI 生成的内容
tywtyw2002
V2EX  ›  程序员

有没有什么语言对 shell 友好但是没 shell 这么蛋疼的?

  •  
  •   tywtyw2002 · Oct 22, 2014 via iPhone · 4968 views
    This topic created in 4397 days ago, the information mentioned may be changed or developed.
    感觉shell功能强大,处理日志文件非常好,但是function和一些计算功能用起来是在太蛋疼了,比如根据数据分类啥的,函数没有返回,没有输入。

    python呢相反,function写起来方便,而且计算和数据处理很不错,但是下东西和对文件操作没有shell下用curl和其他命令方便。


    有没有什么语言结合这两者的优点了呢,调用shell下面的command line tool非常方便,又可以对command line tool返回的结果进行处理不是那么蛋疼。
    19 replies  •  2014-10-22 21:14:55 +08:00
    mcfog
    mcfog
    Oct 22, 2014❤️1
    1
    宇宙最好的语言PHP

    ```
    #!/usr/bin/env php
    <?php

    $user = `whoami`;

    echo "Hello $user";
    ```
    sysno
    sysno
    Oct 22, 2014
    2
    Perl 是你不二的选择。
    Kabie
    Kabie
    Oct 22, 2014
    3
    ipython
    ostholz
    ostholz
    Oct 22, 2014
    4
    <Everyday Scripting with Ruby>
    lushl9301
    lushl9301
    Oct 22, 2014
    5
    [http://stackoverflow.com/questions/366980/what-are-the-differences-between-perl-python-awk-and-sed]

    我其实觉得要么用透一个工具;要么就几个配合,怎么爽就怎么来。
    我写了几个分析paper abstract的代码,先用perl的Regex和stem library大量剔除没用的,然后用python的dict把剩下有用的整理起来。。。
    chevalier
    chevalier
    Oct 22, 2014
    6
    iPython
    mind3x
    mind3x
    Oct 22, 2014❤️1
    7
    你可以看看awk
    kaidee
    kaidee
    Oct 22, 2014
    8
    看看Python的 subprocess 是不是你想要的
    Tink
    Tink
    Oct 22, 2014
    9
    python啊
    764664
    764664
    Oct 22, 2014
    11
    Ruby & Python
    ChiangDi
    ChiangDi
    Oct 22, 2014 via Android
    12
    Ruby,可以反引号直接执行 shell 命令,简直不能更爽。
    klong13579
    klong13579
    Oct 22, 2014
    13
    shell 可以获取返回啊
    aveline
    aveline
    Oct 22, 2014
    14
    PowerShell :-D
    dorentus
    dorentus
    Oct 22, 2014 via iPhone
    15
    fish shell
    ryd994
    ryd994
    Oct 22, 2014
    16
    那就python专门处理数据,shell pipe进去就好
    superwbd
    superwbd
    Oct 22, 2014
    17
    import os

    os.system("wget \'https://www.v2ex.com/\'")



    至于文件操作。。。不觉得python差啊。。。
    hjc4869
    hjc4869
    Oct 22, 2014
    18
    @aveline linux哭
    ericFork
    ericFork
    Oct 22, 2014
    19
    https://pypi.python.org/pypi/sh

    这个可以玩玩,挺有意思
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   4834 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 153ms · UTC 05:52 · PVG 13:52 · LAX 21:52 · JFK 00:52
    ♥ Do have faith in what you're doing.