Shell automatically processes views, conrollers, and routes links of multiple play websites.

Source: Internet
Author: User

[Python] #/bin/bash if [-f "conf/routes"]; then rm conf/routes # if the routes file exists, delete fi if [-f "conf/locked"]; then rm conf/locked # If the locked file is deleted (prevent repeated compilation of play), fi cp conf/routes. bak conf/routes # Back up routes. bak copy to routes dir1 = "/ubuntu/sites1/" dir2 = "/ubuntu/sites2/" declare-a arr [0] = $ dir1 "project1-com" arr [1] = $ dir2 "project2-com" arr [2] = $ dir1 "project3-com" arr [3] = $ dir2 "project4-com" arr [4] = $ dir1 "pr Oject1-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]; then rm-rf $4 $1 # if a file with the same name exists under conf/route/, delete fi if [-f "app/controllers/" $5 ". scala "]; then rm" app/controllers/"$5 ". scala "# if an app/conrollers/file with the same name exists, delete fi if [-f $2] /" $3] | [-d $2] /" $3]; then ln-s $2 links /" $3 $4 $1 # if a file or folder exists, create a link to else echo $2 links /" $3 "no found" f I} for (count = 0, I = 0; count <a_len; I ++ )) do name =$ {arr [$ count]} temp =$ {name ##*/} # Remove the path, change the project name temp =$ {temp/-/_} # To _ y =$ {temp/_/} # Remove _ u = $ (tr '[a-z] ''[A-Z] '<" $ {y: 0: 1} ") tempC =$ {u }$ {y: 1} # lnIt $ temp $ name "conf/routes" "conf/route/" $ tempC lnIt $ temp $ name "app/views" "app/views/" $ tempC lnIt $ temp $ name "app/controllers" "app/controllers /. "$ tempC let count + = 1 done if the declare not found error occurs, d From Ubuntu 6.10, change the previous bashshell to dash (to be verified ). in the dash setting instructions, enter www.2cto. comThe 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. generally, the default shell is B. Ash shell, but as long as it is compatible with POSIX shell, and dash is faster and smaller than bash, so Ubuntu installed dash. How can we remove dash and use the default bash? Run the following command: sudo dpkg-reconfigure dashthis command is to re-configure the installed package. In the menu (dash-bash-sh.png), select whether to link sh to dash (Install dash as/bin/sh ?) Select No.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.