執行腳本並尋找遠端電腦上的路徑

執行腳本並尋找遠端電腦上的路徑

我正在嘗試執行以下腳本來查找遠端路徑上的目錄路徑我是腳本編寫新手,無法理解我出錯的地方有人可以幫我糾正它嗎?

!/bin/sh
ssh ssmis "echo Hello I am Logged in  `hostname` and getting ready to transfer and convert your files ;source .bash_profile;array=(asd-005-cpu eims-asd-005-apcpu);
for item in ${array[*a]};
do
echo $item;
path2=find /nnn/n4/db4/health -type f "${item}" -print;
echo $path2;
done;"

答案1

將最外面的雙引號更改為單引號,否則當前 shell 將解釋並替換您發送到遠端伺服器的內容。最好還是在遠端編寫一個腳本並遠端執行該腳本以避免引用問題。

相關內容