Skip to main content

Posts

Showing posts with the label script

Perl & PHP Shell Scripts

Writing scripts in bash is lame. I'm not the only one who thinks so: Shell Script Language – Use Perl, Not Bash | LinDesk From the post: Advantages of using a Shell Language Its supported in even the tinest linux distros – even in embedded systems. Its the method preferred by the majority – I hope this will change soon. Command calls look more natural in a shell language. Advantages of using a High Level Language Better Code Easy to maintain Faster development Libraries provide a lot of functionality Easier to port to different platforms. PHP Shell Scripting Want to get busy slinging code? Start here: An Introduction to Linux Shell Scripting: How to Use Bash, Perl, PHP or Python in a Linux Script | Suite101.com An Alternative to Perl: Shell Scripting With PHP Using PHP As A Shell Scripting Language PHPDeveloper.org: PHPHacks.com: Shell Scripting with PHP CLI

Configuring Joomla Safe Mode on a Plesk box

At Cadent , we use Parallels Plesk Control Panel Software for Hosting on our servers (we’ve also used the open source Webmin and the commercial CPanel). Plesk has a great user interface, which our clients appreciate. It also imposes its own way of doing things, which can be a bit of a pain when tracking down subtle issues with server configuration. Because Plesk rewrites many configuration files automatically, it’s really critical to ensure that I make any manual changes to the server configuration in the right place, or Plesk will overwrite my efforts without remorse. The issue we needed to address was this: we installed Joomla! 1.0 on our development server, and Joomla reported the following configuration problems:         •        Safe mode was on, needs to be off.         •        The session directory was unwriteable. PHP: Safe Mode is a global setting allows only a file's owner or group to execute the script or read a file. Clearly, this is a good thing for security...

Strip bash comments with grep

Sometimes, you just want to see the code ... Let's say you want to look at a bash script, but strip out all the comments. Here's a sample command using grep that will display a bash script, without comments, to stout: grep -v "^#" commented-script.sh Notes: "-v" means invert the selection; i.e., only display the lines in the file that don't match. "^#" is the regular expression that matches "lines that start with #". "^" means only match the beginning of the line. Replace "commented-script.sh" with the file name of the file you want to strip. Tips: This command strips single line comments from any programming language. Just change the comment line character (";" instead of "#" for example). If you just want to read the comments, drop the "-v" switch.