Linux下程序報(bào)出/bin/bash: No such file or directory
技術(shù)支持服務(wù)電話:15308000360 【7x24提供運(yùn)維服務(wù),解決各類(lèi)系統(tǒng)/軟硬件疑難技術(shù)問(wèn)題】
以如下腳本為例,
#!/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側(cè)欄選擇UNIX Format
2.Encoding菜單欄里選擇Encode in UTF-8 without BOM
這樣在Linux下跑不會(huì)報(bào)出/bin/bash: No such file or directory的錯(cuò)誤