读书人

shell 自动处置play多网站的views,con

发布时间: 2013-03-01 18:33:02 作者: rapoo

shell 自动处理play多网站的views,conrollers,routes链接
play多网站请见

#/bin/bash if [ -f "conf/routes" ]; thenrm conf/routes #如果routes文件存在删除fiif [ -f "conf/locked" ]; thenrm conf/locked #如果locked文件文件存在删除(防止play重复编译)ficp conf/routes.bak conf/routes #把备份routes.bak拷贝成routesdir1="/ubuntu/sites1/"dir2="/ubuntu/sites2/"declare -a arr arr[0]=$dir1"project1-com"arr[1]=$dir2"project2-com"arr[2]=$dir1"project3-com"arr[3]=$dir2"project4-com"arr[4]=$dir1"project1-cn"arr[5]=$dir1"project2-cn"arr[6]=$dir2"project3-cn"arr[7]=$dir2"project4-cn"a_len=${#arr[@]}function lnIt{if [ -h $4$1 ]; thenrm -rf $4$1 #如果conf/route/下存在同名文件,删除fiif [ -f "app/controllers/"$5".scala" ];thenrm "app/controllers/"$5".scala" #如果app/conrollers/下存在同名文件,删除fiif [ -f $2"/"$3 ] || [ -d $2"/"$3 ]; thenln -s $2"/"$3 $4$1 #如果文件或文件夹存在,建立链接elseecho $2"/"$3 " no found"fi}for((count=0,i=0;count<a_len;i++)) do name=${arr[$count]}temp=${name##*/} #去掉路径,取项目名temp=${temp/-/_} #变-为_ y=${temp/_/} #去掉_u=$(tr '[a-z]' '[A-Z]'<<<"${y:0:1}")tempC=${u}${y:1} #首字母大写 lnIt $temp $name "conf/routes" "conf/route/" $tempClnIt $temp $name "app/views" "app/views/" $tempClnIt $temp $name "app/controllers" "app/controllers/." $tempClet count+=1done

如果出现declare not found 错误,请参见如下资料

http://www.cnblogs.com/Trekshot/archive/2010/03/29/1699383.html


dash(Debian Almquist SHell) Ubuntu 自 6.10 后,将先前的 bashshell 更换成了dash (有待考证). 在设置 dash 的说明中有下面文字:

The default /bin/sh shell on Debian and Debian-based systems is bash.However, since the default shell is required to be POSIX-compliant, anyshell that conforms to POSIX, such as dash, can serve as /bin/sh. You may wish to do this because dash is faster and smaller than bash.

大致意思是说默认的 shell 是 bash shell, 但只要是能兼容 POSIX 的 shell 都可以,而dash 比 bash 速度更快、更小巧,因此 Ubuntu 安装了 dash.

怎么能把 dash 去掉而使用默认的 bash?使用如下命令:

sudo dpkg-reconfigure dash

此命令是对已安装的包进行重新配置,在菜单(dash-bash-sh.png)中选择是否将 sh 链接到 dash (Install dash as /bin/sh?) 选择否即可


读书人网 >编程

热点推荐