wikinee
V2EX  ›  macOS

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

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

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