[英]Refering file path by variable in shell script
我想通過腳本中的變量引用文件路徑,但不了解語法。
#!/bin/bash
filepath = /tibcouat1_fs/tibco/deployment/egypt/bnk/broker/logs/;
echo "============BNKBroker=============="
grep 'EXSTAT|' $filepath/bnkbroker.log
查找上面創建的腳本,我在下面出現錯誤。
bash-3.2$ ./BNKSrvcList.sh
./BNKSrvcList.sh: line 2: filepath: command not found
============BNKBroker===== =========
grep: can't open /bnkbroker.log
bash-3.2$
等號(=)的兩側不能有空格,請嘗試以下操作:
filepath=/tibcouat1_fs/tibco/deployment/egypt/bnk/broker/logs/
試試這個
filepath='/tibcouat1_fs/tibco/deployment/egypt/bnk/broker/logs/';
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.