<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: bash code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Mon, 08 Sep 2008 06:00:55 GMT</pubDate>
    <description>DZone Snippets: bash code</description>
    <item>
      <title>Watch a log and/or search for a certain term</title>
      <link>http://snippets.dzone.com/posts/show/2066</link>
      <description>If you're developing on a server that has all PHP errors turned off, you can still watch the error log (if you have access to this file). For example on a dreamhost account you could try this:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;tail -f /home/account/logs/website.com/http/error.log&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;As the errors pour in, you will see them come by. Change 'account' to the username you have on dreamhost and website.com to the domainname you host there. If the errors come in large amounts you can filter them by using grep:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;tail -f /home/account/logs/website.com/http/error.log | grep -i "search_term"&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Now only errors containing 'search_term' will be shown.</description>
      <pubDate>Thu, 18 May 2006 00:29:47 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/2066</guid>
      <author>yoghoyogho ()</author>
    </item>
    <item>
      <title>Quickly download the PEAR libraries</title>
      <link>http://snippets.dzone.com/posts/show/2065</link>
      <description>To get a headstart for your website you can use the PEAR libraries. The following script downloads a couple of the most handy libraries, and also adds some symbolic links to the newly downloaded files.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;#!/bin/bash&lt;br /&gt;pear config-create $HOME $HOME/.pearrc&lt;br /&gt;pear config-set php_dir $HOME/pear/lib&lt;br /&gt;&lt;br /&gt;pear install -a PEAR&lt;br /&gt;&lt;br /&gt;pear channel-update pear.php.net&lt;br /&gt;pear install -a DB Mail&lt;br /&gt;pear install -o Auth Auth_SASL Cache_Lite File&lt;br /&gt;pear install -o HTML_QuickForm HTML_TreeMenu&lt;br /&gt;pear install -o HTTP HTTP_Request&lt;br /&gt;pear install -o Mail_Mime&lt;br /&gt;pear install -o Log Pager&lt;br /&gt;pear install -o Translation2-beta XML_Serializer-beta&lt;br /&gt;&lt;br /&gt;ln -s ~/pear/pear ~/bin/pear&lt;br /&gt;ln -s ~/pear/peardev ~/bin/peardev&lt;br /&gt;ln -s ~/pear/pecl ~/bin/pecl&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Thu, 18 May 2006 00:23:51 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/2065</guid>
      <author>yoghoyogho ()</author>
    </item>
    <item>
      <title>Replace old style PHP tags to new style tags</title>
      <link>http://snippets.dzone.com/posts/show/2064</link>
      <description>Sometimes you have to work with scripts that contain old-style PHP tags. This little snippets fixes those scripts, so they use the new style PHP tags.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;find * -type f -exec perl -i -wpe 's/&lt;\?php/&lt;\?/g' {} \;&lt;br /&gt;find * -type f -exec perl -i -wpe 's/&lt;\?/&lt;\?php/g' {} \;&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Thu, 18 May 2006 00:21:11 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/2064</guid>
      <author>yoghoyogho ()</author>
    </item>
    <item>
      <title>Check the syntax of a bunch of PHP files all at once</title>
      <link>http://snippets.dzone.com/posts/show/2063</link>
      <description>Will find all files ending with 'php' and execute the syntax check of php for every found file. Useful if you quickly want to see which php file contains a parse error.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;find ./ -type f -name \*.php -exec php -l {} \;&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Thu, 18 May 2006 00:19:40 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/2063</guid>
      <author>yoghoyogho ()</author>
    </item>
    <item>
      <title>Search for files modified the last ... days</title>
      <link>http://snippets.dzone.com/posts/show/2062</link>
      <description>Searches for files modified up to 4 days ago. Change the 4 to whatever you desire.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;find ./ -type f -mtime -4 -exec ls -al {} \;&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Thu, 18 May 2006 00:17:20 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/2062</guid>
      <author>yoghoyogho ()</author>
    </item>
    <item>
      <title>Find files with a certain extension, where the files contain a certain search term</title>
      <link>http://snippets.dzone.com/posts/show/2061</link>
      <description>Searches the current directory and deeper for files ending with the 'php' extension, where the file itself contains 'search_term'. Useful if you're searching a large website with lots of images and you only want to find a certain function or variable.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;find ./ -type f -name \*.php -exec grep -il "search_term" {} \;&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Thu, 18 May 2006 00:15:34 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/2061</guid>
      <author>yoghoyogho ()</author>
    </item>
    <item>
      <title>Find files with certain extensions</title>
      <link>http://snippets.dzone.com/posts/show/2060</link>
      <description>Searches the current directory and deeper for several extensions. In this example both files mathing 'php', 'html' and 'tpl' match the search.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;find ./ -regex ".*\(php\|html\|tpl\)$"&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;As an alternative you could also use:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;find ./ -iname "*.php" -or -iname "*.tpl" -or -iname "*.html"&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Thu, 18 May 2006 00:12:42 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/2060</guid>
      <author>yoghoyogho ()</author>
    </item>
    <item>
      <title>Find files with a certain extension</title>
      <link>http://snippets.dzone.com/posts/show/2059</link>
      <description>Searches the current directory and deeper for all files having an extension 'php'. Change this to the extension you're looking for.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;find ./ -type f -name \*.php&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Thu, 18 May 2006 00:09:26 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/2059</guid>
      <author>yoghoyogho ()</author>
    </item>
  </channel>
</rss>
