我試圖從Windows機器的電源shell執行shell腳本。因此,開始編寫shell腳本並使用以下命令調用到Linux框中:從Windows機器的電源shell執行shell腳本
PS>.\pscp.exe .\abc.sh [email protected]:/root` and gave the permissions through power shell by using below command
PS>.\plink.exe -pw "L***e" [email protected] -P 22 "chmod +x abc.sh"` after that verified that shell script copied or not
PS>.\plink.exe -pw "L***e" [email protected] -P 22 "ls"
因此它被複制。在那之後,當我使用下面的命令執行:
PS>.\plink.exe -pw "L***e" [email protected] -P 22 "bash ./abc.sh"`
這不是在這個意義上得到錯誤的工作,如:
./abc.sh: line 4: $'\r': command not found ./abc.sh:
line 5: syntaxerror near unexpected token `$'\r'' '/abc.sh:
line 5: `function abc()
PS>.\plink.exe -pw "L***e" [email protected] -P 22 "./abc.sh"
bash: ./abc.sh: /bin/bash^M: bad interpreter: No such file or directory
如果任何有價值的建議和可觀的感謝提前......