Linux Shell執行source或.命令報錯'bash: ..: command not found'

feelpurple發表於2016-09-07
Linux Shell執行source命令報錯
[root@localhost fire]# vi config.ini

VERSION_LEVEL_TABLE = 'version'
SQL_SCRIPT_NAME = 'e'
[root@localhost fire]# . config.ini
bash: VERSION_LEVEL_TABLE: command not found
bash: SQL_SCRIPT_NAME: command not found
[root@localhost fire]# source config.ini
bash: VERSION_LEVEL_TABLE: command not found
bash: SQL_SCRIPT_NAME: command not found

報錯原因:宣告的變數和等號之間有空格

[root@localhost fire]# vi config.ini
VERSION_LEVEL_TABLE='version'
SQL_SCRIPT_NAME='e'
[root@localhost fire]# . config.ini
[root@localhost fire]# echo $VERSION_LEVEL_TABLE $SQL_SCRIPT_NAME
version e

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26506993/viewspace-2124664/,如需轉載,請註明出處,否則將追究法律責任。

相關文章