lcj2class
V2EX  ›  编程

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

  •  
  •   lcj2class · Apr 6, 2024 · 2202 views
    This topic created in 770 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   ·   2919 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 70ms · UTC 07:00 · PVG 15:00 · LAX 00:00 · JFK 03:00
    ♥ Do have faith in what you're doing.