V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
lcj2class
V2EX  ›  编程

[文章分享] 健壮 Shell 脚本编写指南

  •  
  •   lcj2class · Apr 6, 2024 · 2174 views
    This topic created in 764 days ago, the information mentioned may be changed or developed.
    6 replies    2024-08-15 02:44:04 +08:00
    cndns
        1
    cndns  
       Apr 6, 2024 via Android
    有个工具叫 Shellcheck 可以检查脚本
    X-Force
        2
    X-Force  
       Apr 6, 2024
    很赞!写了很多 Shell 脚本,踩过很多坑,老实说这语言真的对新手用户不甚友好。
    june4
        3
    june4  
       Apr 7, 2024
    重要的是加 -e 参数
    #!/bin/bash -e
    否则程序错了还在不停往下运行,到时出什么意外都可能
    lisxour
        5
    lisxour  
       Apr 7, 2024
    想健壮就不应该用 shell
    Linioi
        6
    Linioi  
       Aug 15, 2024
    @X-Force 当初还没接触正经的编程语言,最早写的就是 Shell ,后面开始学 Python 还觉得不方便 hh
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3749 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 41ms · UTC 00:06 · PVG 08:06 · LAX 17:06 · JFK 20:06
    ♥ Do have faith in what you're doing.