如何在cygwin中運行.sh檔案?

來源:互聯網
上載者:User
以下是原來在linux下可以啟動並執行auto.sh檔案的內容,現在在windows伺服器下運行。安裝了cygwin、

#!/bin/sh
#
#Script to export
#
while : ;
do

php -d session.save_path=/dev/null -f /www/test.php > /dev/null
sleep 3
done

運行時報錯

-bash-4.1$ ./auto.sh
./auto.sh: line 10: syntax error near unexpected token `done'
./auto.sh: line 10: `done'

是什麼原因呢?是我沒有安裝cygwin沒有安裝shell庫還是什麼原因呢?
select packages to install時
選Shells bash: 和bash-completion:嗎 還是什麼原因,願用過的朋友指點,感激不盡!


回複討論(解決方案)

同樣的問題,求解決

因為MS-DOS及Windows是斷行符號+換行來表示換行,因此在Linux下用Vim查看在Windows下用VC寫的代碼,行尾後的“^M”符號,表示的是符。
現在,你使用vim -b 開啟你的檔案。就會發現每一行都有^M ,那麼我們可以是用全域替換替換掉

地址:http://hi.baidu.com/dmkj2008/item/0b58d20c228a9f8e03ce1b46
我在百度看到的,我的也是這問題,希望能解決一些人問題

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.