vgra 发表于 2011-05-12 15:38

问个shell脚本的问题

在CentOS Linux下面下面的这个脚本能正常运行

$ cat foo.sh
#/bin/sh

dir="`pwd`"
echo $dir
dir=${dir%/*}
echo $dir
但是在SunOS 5.10下面,无法运行,提示 bad substitution

bash-3.00# sh -x foo.sh
+ pwd
dir=/opt/JReport/Server_V10.1/derby/bin
+ echo /opt/JReport/Server_V10.1/derby/bin
/opt/JReport/Server_V10.1/derby/bin
foo.sh: bad substitution
要怎么改一下涅
谢谢

doni 发表于 2011-05-12 18:29

ksh,bash都可以

bj161109 发表于 2011-05-13 09:30

你先贴出在Cento OS的结果
页: [1]
查看完整版本: 问个shell脚本的问题