Skip to content
挨踢攻城獅學習之路
  • 作業系統
    • Windows
    • Linux
  • 資料庫
    • SQL Server
    • MySQL/MariaDB
  • 腳本
    • PowerShell
    • Shell Script
  • 開源服務
  • 虛擬化
  • 容器
  • 雲服務
  • 網路
  • 其他
  • WordPress
  • Javascript
  • PHP

ShellScript:bash 與 sh 不一樣的坑 [[: not found

Shell Script / By Qoo

寫了一段 Shell

if [[ $a!= $b || $c != $d ]]; then

在不同功能的 Container 下執行時,碰到以下錯誤

[[: not found

爬文發現 [[ ]] 在 sh 下運行會有問題,但該 container 沒有 bash,故需改寫為

if [ $a != $b ] || [ $c != $d ]; then

來源:String comparison in bash. [[: not found

文章導覽
← Previous 文章
Next 文章 →

近期文章

  • Skype:申請 Notify Bot 機器人流程
  • PHP:Line Bot 開發 Server 問題紀錄
  • ShellScript:Cloudflare API v4 動態更新 IP 實現 DDNS 功能
  • Tampermonkey:網頁表單自動輸入簡易相加的計算驗證碼
  • Edge 網址列預設不搜尋書籤、要怎麼快速搜尋書籤

分類

  • WordPress (28)
  • 作業系統 (44)
    • Linux (30)
    • Windows (15)
  • 全端 (28)
    • CSS (3)
    • Dev Env (4)
    • Go (1)
    • Javascript (14)
    • PHP (6)
  • 其他 (9)
  • 容器 (10)
    • Docker (7)
    • Kubernetes (2)
  • 網路 (6)
  • 腳本 (13)
    • Batch (3)
    • PowerShell (4)
    • Shell Script (7)
  • 虛擬化 (8)
  • 資料庫 (9)
    • MySQL/MariaDB (1)
    • SQL Server (8)
  • 開源服務 (18)
  • 雲服務 (1)

標籤

analysis apache backup batch centos cisco cmder command css docker duplicati esxi firewall fortigate git hyper-v javascript kubernetes librenms linux mariadb meeting network nextcloud nfs nginx php plugins powershell redmine samba security selinux shellscript sql ssh troubleshooting vembu Visual Studio vps vue.js wordpress wsl xsibackup zfs
Copyright © 2022 挨踢攻城獅學習之路 | Powered by Astra WordPress Theme