( ! ) Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/lib/menu/GKBase.class.php on line 114
Call Stack
#TimeMemoryFunctionLocation
10.0013413904{main}( ).../index.php:0
20.36114272936Joomla\CMS\Application\SiteApplication->execute( ).../index.php:49
31.213513046864Joomla\CMS\Application\SiteApplication->render( ).../CMSApplication.php:202
41.213713046808Joomla\CMS\Application\SiteApplication->render( ).../SiteApplication.php:778
51.213813047184Joomla\CMS\Document\HtmlDocument->parse( ).../CMSApplication.php:1030
61.213813047184Joomla\CMS\Document\HtmlDocument->_fetchTemplate( ).../HtmlDocument.php:545
71.214013047280Joomla\CMS\Document\HtmlDocument->_loadTemplate( ).../HtmlDocument.php:730
81.214613084912require( '/var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/component.php' ).../HtmlDocument.php:668
91.237213375592GKTemplate->__construct( ).../component.php:31
101.261813517112GKTemplateMenu->getMenuType( ).../gk.framework.php:84
111.263013561376require_once( '/var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/lib/menu/GKMenu.php' ).../helper.menu.php:19

( ! ) Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/lib/menu/GKHandheld.php on line 76
Call Stack
#TimeMemoryFunctionLocation
10.0013413904{main}( ).../index.php:0
20.36114272936Joomla\CMS\Application\SiteApplication->execute( ).../index.php:49
31.213513046864Joomla\CMS\Application\SiteApplication->render( ).../CMSApplication.php:202
41.213713046808Joomla\CMS\Application\SiteApplication->render( ).../SiteApplication.php:778
51.213813047184Joomla\CMS\Document\HtmlDocument->parse( ).../CMSApplication.php:1030
61.213813047184Joomla\CMS\Document\HtmlDocument->_fetchTemplate( ).../HtmlDocument.php:545
71.214013047280Joomla\CMS\Document\HtmlDocument->_loadTemplate( ).../HtmlDocument.php:730
81.214613084912require( '/var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/component.php' ).../HtmlDocument.php:668
91.237213375592GKTemplate->__construct( ).../component.php:31
101.265913684120GKTemplateMenu->getMenuType( ).../gk.framework.php:85
grep 正则表达式选项要记得转义
Logo
Print this page

grep 正则表达式选项要记得转义

使用过程中,使用最多的参数就是 -v ,但是用着并不爽。

比如说,我想查找一个单词“UserService”,但是像”*.svn” 这种文件就不用显示了,我该怎么做呢?

grep -r "UserService" ./ | grep -v "svn"

但是,如果类似于含有”test、auto_load”之类的文件我也不显示,怎么做呢?我之前的做法是:

grep -r "UserService" ./ | grep -v "svn" | grep -v "test" | grep -v "auto_load"

命令很长,而且麻烦,于是就想,grep本身是按照正则表达式来当做选项的,那么我是不是可以利用到正则表达式的“或|”命令?

grep -r "UserService" ./ | grep -v "svn|test|auto_load"

很显示,执行结果显示上面的命令不符合我的需求,于是苦思不得其解。原来,在使用正则表达式选项时,要记得将”|”转义。最终命令如下:

grep -r "UserService" ./ | grep -v "svn\|prj\|test\|auto_load"

( ! ) Warning: count(): Parameter must be an array or an object that implements Countable in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/item.php on line 169
Call Stack
#TimeMemoryFunctionLocation
10.0002405416{main}( ).../index.php:0
20.06921323856Joomla\CMS\Application\SiteApplication->execute( ).../index.php:49
30.06921323856Joomla\CMS\Application\SiteApplication->doExecute( ).../CMSApplication.php:196
40.28772982336Joomla\CMS\Application\SiteApplication->dispatch( ).../SiteApplication.php:233
50.28833007016Joomla\CMS\Component\ComponentHelper::renderComponent( ).../SiteApplication.php:194
60.28903062344Joomla\CMS\Component\ComponentHelper::executeComponent( ).../ComponentHelper.php:377
70.28903079400require_once( '/var/www/vhosts/shan.info/httpdocs/components/com_k2/k2.php' ).../ComponentHelper.php:402
80.29523223488K2ControllerItem->execute( ).../k2.php:64
90.29523223488K2ControllerItem->display( ).../BaseController.php:710
100.30073492568K2ControllerItem->display( ).../item.php:78
110.30073492568K2ControllerItem->display( ).../controller.php:19
120.30233511088Joomla\CMS\Cache\Controller\ViewController->get( ).../BaseController.php:663
130.35133531504K2ViewItem->display( ).../ViewController.php:102
140.42134098576K2ViewItem->display( ).../view.html.php:742
150.42134098576K2ViewItem->loadTemplate( ).../HtmlView.php:230
160.42294272976include( '/var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/item.php' ).../HtmlView.php:701

( ! ) Notice: Only variables should be assigned by reference in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/item.php on line 478
Call Stack
#TimeMemoryFunctionLocation
10.0002405416{main}( ).../index.php:0
20.06921323856Joomla\CMS\Application\SiteApplication->execute( ).../index.php:49
30.06921323856Joomla\CMS\Application\SiteApplication->doExecute( ).../CMSApplication.php:196
40.28772982336Joomla\CMS\Application\SiteApplication->dispatch( ).../SiteApplication.php:233
50.28833007016Joomla\CMS\Component\ComponentHelper::renderComponent( ).../SiteApplication.php:194
60.28903062344Joomla\CMS\Component\ComponentHelper::executeComponent( ).../ComponentHelper.php:377
70.28903079400require_once( '/var/www/vhosts/shan.info/httpdocs/components/com_k2/k2.php' ).../ComponentHelper.php:402
80.29523223488K2ControllerItem->execute( ).../k2.php:64
90.29523223488K2ControllerItem->display( ).../BaseController.php:710
100.30073492568K2ControllerItem->display( ).../item.php:78
110.30073492568K2ControllerItem->display( ).../controller.php:19
120.30233511088Joomla\CMS\Cache\Controller\ViewController->get( ).../BaseController.php:663
130.35133531504K2ViewItem->display( ).../ViewController.php:102
140.42134098576K2ViewItem->display( ).../view.html.php:742
150.42134098576K2ViewItem->loadTemplate( ).../HtmlView.php:230
160.42294272976include( '/var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/item.php' ).../HtmlView.php:701
Template Design © Joomla Templates | GavickPro. All rights reserved.