wikinee
V2EX  ›  macOS

Mac 的 shell 和 Linux 的 shell 差距有多大

  •  
  •   wikinee · Aug 22, 2015 · 7075 views
    This topic created in 3925 days ago, the information mentioned may be changed or developed.
    看鸟哥的脚本,照着例子写了几个
    发现:
    echo - e “会把- e 这个参数都数出来”

    date --date='2 days ago' 会报格式错误
    14 replies    2015-08-29 06:17:35 +08:00
    hiv2itsme
        1
    hiv2itsme  
       Aug 22, 2015
    shell 都是 bash,有区别的是个体命令,有差别的还是蛮多的。
    Comphuse
        2
    Comphuse  
       Aug 22, 2015
    Mac 下面是 BSD 组件,不是 GNU coreutils 。
    ovear
        3
    ovear  
       Aug 22, 2015
    df -lh...
    wikinee
        4
    wikinee  
    OP
       Aug 22, 2015
    @hiv2itsme 嗯,挺大的
    @Comphuse 我把这茬给忘了,罪过。 Mac 压根不是 linux 是 unix
    @ovear 这是啥
    haogefeifei
        5
    haogefeifei  
       Aug 22, 2015
    Linux 有好多乱七八糟的命令 Mac 上是没有的, Mac 上也好多独有的命令 Linux 上没有。。。这两类 Unix 系统各自发展好多年了,有差异是正常的。。。
    Daniel65536
        6
    Daniel65536  
       Aug 22, 2015
    你得 brew install coreutils
    aheadlead
        7
    aheadlead  
       Aug 22, 2015 via iPhone
    pstree
    hardware
        8
    hardware  
       Aug 22, 2015
    lsusb
    lxrmido
        9
    lxrmido  
       Aug 22, 2015
    du --max-depth
    du -d
    guoziyan
        10
    guoziyan  
       Aug 23, 2015
    @hardware lsbom ...
    jyf007
        11
    jyf007  
       Aug 23, 2015
    nextstep 具体看程序员杂志有个传,原来有个项目是 mklinux 后来谈崩了才变成 bsd 系的
    bleaker
        12
    bleaker  
       Aug 23, 2015
    好像是 OS X 开发的时候乔布斯去找了 Linus ,然后被喷回来了。。
    FurN1
        13
    FurN1  
       Aug 23, 2015
    homebrew 为什么存在?回答了这个问题就好啦。
    cxbig
        14
    cxbig  
       Aug 29, 2015
    替换并写入原文件,-i 后面必须要带空字符串 '' 才能写回原文件
    sed -i '' -E 's/str_a/str_b/'

    sed 下大多数 option 都和 linux 不一样
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5301 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 64ms · UTC 08:42 · PVG 16:42 · LAX 01:42 · JFK 04:42
    ♥ Do have faith in what you're doing.