Linux下程序報出/bin/bash: No such file or directory
技術支持服務電話:15308000360 【7x24提供運維服務,解決各類系統/軟硬件疑難技術問題】
以如下腳本為例,
#!/bin/bash
conn='mysql -upitt -p123456 -hhostname --default-character-set=UTF8 database'
`$conn -e "select Name from Product1 where Type='Live'" > a.txt`
`$conn -e "select Name from Product2 where Type='Live'" >> a.txt`
echo "query end"
echo "start check"
`cd /home/user/NameCheck`
`grep '@' a.txt | wc -l > result.txt`
使用Notepad++編輯器,
1.Edit菜單欄里選擇EOL Conversion側欄選擇UNIX Format
2.Encoding菜單欄里選擇Encode in UTF-8 without BOM
這樣在Linux下跑不會報出/bin/bash: No such file or directory的錯誤