[問題] ubuntu bash let not found

看板Linux作者 (匈奴將領)時間9年前 (2015/01/12 20:34), 編輯推噓4(4014)
留言18則, 10人參與, 最新討論串1/1
剛剛在寫bash script的時候 完成後要執行 輸入的command $ sh test.sh 結果出現 let command not found 上網找到答案 原來只要 $ bash test.sh 執行就沒有問題了 原因是 bin/sh is dash not bash 聽不太懂他的意思 想了解是什麼原因 謝謝~ -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 140.117.164.19 ※ 文章網址: https://www.ptt.cc/bbs/Linux/M.1421066088.A.C88.html

01/12 20:59, , 1F
ubuntu 預設的 shell 是 dash
01/12 20:59, 1F

01/12 20:59, , 2F
所以你開的根本不是 bash 有些東西是 bash 沒有的
01/12 20:59, 2F

01/12 20:59, , 3F
s/沒有的/才有的/
01/12 20:59, 3F

01/12 21:03, , 4F
那source跟.是不是也不一樣
01/12 21:03, 4F

01/12 21:21, , 5F
感謝一樓
01/12 21:21, 5F

01/12 22:10, , 6F
愣了3秒才看懂3F XD
01/12 22:10, 6F

01/12 23:48, , 7F
我也是ubuntu,不過我的預設是bash...
01/12 23:48, 7F

01/13 10:44, , 8F
ubuntu預設不是一直都是bash嗎?有換過?
01/13 10:44, 8F

01/13 11:48, , 9F
14.04是dash
01/13 11:48, 9F

01/13 11:49, , 10F
lrwxrwxrwx 1 root root 4 2月 19 2014 /bin/sh -> dash
01/13 11:49, 10F

01/13 14:16, , 11F
10還是11 script shell就改dash了,login還是bash沒動
01/13 14:16, 11F

01/13 15:26, , 12F
原來有換@@。dash好用嗎?我現在都用zsh...
01/13 15:26, 12F

01/13 15:33, , 13F
dash 主要是拿來跑 script 用的,直接用不太方便
01/13 15:33, 13F

01/13 23:22, , 14F
養成習慣在第一行 嗆明要用那個 shell 跑就好了。
01/13 23:22, 14F

01/14 07:04, , 15F
推 kdjf:
01/14 07:04, 15F

01/14 10:44, , 16F
01/14 10:44, 16F

01/14 10:44, , 17F
就換過去了
01/14 10:44, 17F

01/14 16:49, , 18F
可以用指令 `readlink -f /bin/sh` 來檢查到底是什麼
01/14 16:49, 18F
文章代碼(AID): #1Kixzeo8 (Linux)