我想通过脚本中的变量引用文件路径,但不知道语法。
#!/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/
关于linux - 在 shell 脚本中通过变量引用文件路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26966462/