2016-07-30 79 views
0

所以我已經得到了這麼多,但它不起作用。它說Bash添加SFTP用戶,主目錄和chmod它

Changing directory to /var/www/sftp... 
: No such file or directoryar/www/sftp 
Making user directory... 
mkdir: cannot create directory ‘luna\r’: File exists 
Making public_html directory... 
mkdir: cannot create directory ‘public_html\r’: File exists 
Copying preset index... 
cp: cannot stat '../../index.html': No such file or directory 
chmoding public_html directory... 

現在的代碼,我已經寫了...

echo Changing directory to /var/www/sftp... 
cd /var/www/sftp 
echo Making user directory... 
mkdir $1 
cd $1 
echo Making public_html directory... 
mkdir public_html 
cd public_html 
echo Copying preset index... 
cp ../../index.html ./index.html 
echo chmoding public_html directory... 
chmod 777 ../public_html 

對於輸出包括我的第二個版本,因爲它創建目錄「紅月\ R」而不是「露娜」 。此外在CD之前的回聲是試圖解決這個問題與裁談會的地方,無論出於什麼原因,它試圖將目錄更改爲「ar/www/sftp」

回答

0

您的腳本有DOS行結尾(回車/換行符,也稱爲CR/LF或0x0D 0x0A)。如果您使用unix行結束符(僅限換行),它可能會更好。

+0

對不起。 Linux noob在這裏。我怎麼做? –