1. 程式人生 > >shell指令碼讀取配置檔案【有圖有真相】

shell指令碼讀取配置檔案【有圖有真相】

配置檔案config.properties

#以下是配置檔案內容,配置檔案檔名為config.properties
username=jack
password=33281

  shell指令碼(指令碼名為 readConfig.sh)

#!/bin/bash
source ./config.properties
echo ${username}

   注意:我這裡把config.properties和readConfig.sh放置在同一資料夾下

  執行結果貼圖

說明:如果轉載請註明出處!!