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

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

  •  
  •   tywtyw2002 · Oct 22, 2014 via iPhone · 4547 views
    This topic created in 4223 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
        1
    mcfog  
       Oct 22, 2014   ❤️ 1
    宇宙最好的语言PHP

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

    $user = `whoami`;

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

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

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



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

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