0
我工作在Solaris 10上,與2.0.4
mongo
版本,收到錯誤通過的bash運行蒙戈shell命令
{root} #: ./mongo --shell --eval 'use db'
MongoDB shell version: 2.0.4
fork() available!
connecting to: test
type "help" for help
Tue Sep 20 14:44:22 compile error: (shell eval):1 SyntaxError: Unexpected identifier
use db
^^
{root} #:
我寫了一個腳本,我試圖插入一組文件在DB:
#!/bin/bash
cd /test2/sam
for f in *.bin.gz do
cd /opt/csw/bin
./mongofiles -l /test2/sam/$f -d mahi put $f SUBSTRING=$(echo $f| cut -c11-19) ./mongo << EOF
use mahi "db.fs.files.update({\ $filename: \"$f" },{ \$set: {"ROP": \"$SUBSTRING"}})"
EOF
done
mahi是db名稱;在執行這個時,我得到的編譯錯誤爲:
Tue Sep 20 15:05:40 compile error: (shell):1 SyntaxError: Unexpected token } _ROOT_MO_R,MeContext=CTL01008_celltracefile_3-1378091167645.bin.gz" },{ $set:
任何導致幫助我解決這個問題,表示讚賞。
我寫了一個腳本,我試圖插入一個集DB#文件!/斌/慶典 CD/TEST2/SAM 對於f以* .bin.gz 做 CD /選擇/ CSW/bin ./mongofiles -l/test2/sam/$ f -d mahi put $ f SUBSTRING = $(echo $ f | cut -c11-19) ./mongo << EOF use mahi 「db.fs .files.update({\ $ filename:\「$ f」},{\ $ set:{「ROP」:\「$ SUBSTRING」}})「 EOF done mahi是db名稱,編譯錯誤:(shell):1 SyntaxError:意外的令牌} _ROOT_MO_R,MeContex t = CTL01008_celltracefile_3-1378091167645.bin.gz「},{$ set: –
您應該使用[edit]按鈕並確保顯示腳本的正確測試。我不得不從評論中猜測。 –