新聞中心
最近一段時間在使用Bash on ubuntu on Windows做shell腳本調(diào)試時發(fā)現(xiàn)在腳本中使用source時會報錯,上網(wǎng)查了下才了解到原來是在Ubuntu中使用的并不是bash,而是使用優(yōu)化過的dash,而在dash中是沒有source,而在bash中才有source,這就有點麻煩了,平時在寫腳本時有時會調(diào)用系統(tǒng)的function和一些自定義的function,沒有source確實有點不太方便,而在此時可以在使用dpkg-reconfigure來修改配置dash,在平時可以用以下方法來驗證看下自己的系統(tǒng)中使用的shell環(huán)境:
root@localhost:~# ls -l $(which sh)
lrwxrwxrwx 1 root root 4 9月 9 22:09 /bin/sh -> dash

成都創(chuàng)新互聯(lián)專注于尼金平企業(yè)網(wǎng)站建設(shè),成都響應(yīng)式網(wǎng)站建設(shè)公司,電子商務(wù)商城網(wǎng)站建設(shè)。尼金平網(wǎng)站建設(shè)公司,為尼金平等地區(qū)提供建站服務(wù)。全流程按需搭建網(wǎng)站,專業(yè)設(shè)計,全程項目跟蹤,成都創(chuàng)新互聯(lián)專業(yè)和態(tài)度為您提供的服務(wù)
修改下:
root@localhost:~# dpkg-reconfigure dash
之后選擇否,此時再看系統(tǒng)中使用的shell環(huán)境就改成bash
root@localhost:~# ls -l $(which sh)
lrwxrwxrwx 1 root root 4 9月 9 22:09 /bin/sh -> bash
在此時就可以使用source
分享題目:Ubuntu中使用source報錯處理辦法
轉(zhuǎn)載來源:http://m.fisionsoft.com.cn/article/cdoseod.html


咨詢
建站咨詢
