deepin如何才能跑mac下的面写的shell脚本
Tofloor
poster avatar
widon1104
deepin
2020-08-09 00:37
Author
公司用mac电脑,shell脚本在mac下跑的挺好的
但是回家发现这个脚本在deepin系统终端上跑不起来,会报错

不知道deepin如何才能跑mac下的面写的shell脚本?


Reply Favorite View the author
All Replies
avatar
SamLukeYes
deepin
2020-08-09 01:04
#1
报什么错啊
Reply View the author
avatar
widon1104
deepin
2020-08-09 01:19
#2

./make.sh: 176: ./make.sh: Bad substitution
widon@widon-deepin:~/golang/src/cdm-go$ cat -n make.sh  | grep 176
   176          for path in ${src[@]}
Reply View the author
avatar
SamLukeYes
deepin
2020-08-09 01:21
#3
https://bbs.deepin.org/post/198619
./make.sh: 176: ./make.sh: Bad substitution
widon@widon-deepin:~/golang/src/cdm-go$ cat -n make.sh ...

两边用的 shell 是一样的吗
Reply View the author
avatar
zhangn1985
deepin
2020-08-09 02:13
#4
尽量用POSIX方法,不要用扩展。

如果用扩展,则要指定SHELL,`#!/bin/env bash`

Reply View the author
avatar
deepinuser17
deepin
2020-08-09 07:30
#5
shell有多种版本,sh, bash, csh, tcsh, zsh等等。深度的初始设定shell是bash. 如果Mac上用的shell不是bash, 你需要针对bash调整脚本。你的问题和深度无关,在任何一个运行bash shell的系统上都会遇到。
Reply View the author
avatar
忘记、过去
deepin
2020-08-09 08:03
#6
macOS 从 10.15 开始默认终端 shell 换成了 zsh,启动时会有提示的。
Reply View the author
avatar
widon1104
deepin
2020-08-10 02:39
#7
deepin默认使用的居然是dash
widon@widon-deepin:~$ ls -l /usr/bin/sh
lrwxrwxrwx 1 root root 4 7月  11 11:35 /usr/bin/sh -> dash
我改了一下脚本内容,然后用bash执行,没问题了
Reply View the author
avatar
SamLukeYes
deepin
2020-08-10 03:48
#8
https://bbs.deepin.org/post/198619
deepin默认使用的居然是dash
widon@widon-deepin:~$ ls -l /usr/bin/sh
lrwxrwxrwx 1 root root 4 7月  11  ...

好像 Debian 系都是默认用 dash 的,Arch 系默认用 bash
Reply View the author