Chỉnh sửa Magic Drush làm Bash Shell

Chỉnh sửa Magic Drush làm Bash Shell

Drush can do a lot of amazing things that escapes most people’s notice.  For example, did you know that you can change your working directory to a local site by using a site alias?

>> Chúng ta cùng thử tìm hiểu, cài đặt Drupal 8 ngay hôm nay

>> Hướng dẫn mua vé dự DrupalCon Los Angeles tháng 5 năm 2015

Just type:

    cdd @mysite

Intriguing? You can make your Drush do this trick with just a little bit of setup.  Drush has always offered a wide range of configuration options, but many Drush users never get deep enough into the documentation to take advantage of these capabilities.  Now, though, it is really easy to get started. In Drush 8.0.0-rc3, there is a new command, core-init (aliased to simply init) to help you get started with a new setup.  To run it, just type:

    drush init

This will print out a list of all of the things that Drush does to set up your configuration for you; one of the things that it does is update your Bash configuration file. It is important to remember, though, that the Bash shell only reads its configuration file when it first starts up. Therefore, after you run drush init, you should also reload your Bash configuration:

    source ~/.bashrc

You have to do this in every open terminal window, but it is only necessary to do this once; if you have too many terminal windows open, you might find it simpler to just restart. Either way, once your Bash configuration has been sourced, you will have a wide range of new shortcuts at your disposal.  For example:

Alias Action
ev ‘return node_load(3);’ Run node_load(3) and print the result.
cc Clear the cache on a Drupal 7 site.
cr Rebuild the cache on a Drupal 8 site.
q 'show tables;' Run an SQL query and print the result.
lsa List all local site aliases.

You can also customize the shortcuts to meet your liking.  Just open up the file ~/.drush/drush.bashrc, and follow the pattern of the aliases that already exist there. Additionally, there is even more customization options available in the file ~/.drush/drushrc.php. Take a look, and see what Drush can do for you!

Bạn thấy bài viết này như thế nào?: 
No votes yet
Ảnh của Tommy Tran

Tommy owner Express Magazine

Drupal Developer having 9+ year experience, implementation and having strong knowledge of technical specifications, workflow development. Ability to perform effectively and efficiently in team and individually. Always enthusiastic and interseted to study new technologies

  • Skype ID: tthanhthuy

Tìm kiếm bất động sản

 

Advertisement

 

jobsora

Dich vu khu trung tphcm

Dich vu diet chuot tphcm

Dich vu diet con trung

Quảng Cáo Bài Viết

 
SEO

Bạn đang SEO quá mức và sẽ ăn phạt

Bạn đang lo lắng về việc website mình sẽ bị phạt bởi Google phát hiện trang đang SEO quá mức. Bạn đang tìm thông tin về các dấu hiệu, các hiện tượng SEO quá mức. Sau đây là 8 dấu hiệu seo quá mức mà bạn nên tham khảo.

Bị kết án 25 năm tù vì nói xấu Hoàng gia Thái Lan trên Facebook

Bị kết án 25 năm tù vì nói xấu Hoàng gia Thái Lan trên Facebook

Một doanh nhân tại Thái Lan đã bị tòa án Quân sự tại nước này kết án 25 năm tù vì tội nói xấu chế độ Hoàng gia trên trang Facebook của mình.

Cách nào tốt nhất để Drupal 6 support after Drupal 8 Official release

Cách nào tốt nhất để Drupal 6 support after Drupal 8 Official release

The first official Drupal 8 release is coming. Ok, so it might seem like it's approaching at a snails pace rather than a speeding juggernaut

Công ty diệt chuột T&C

 

Diet con trung