Skip to main content

Posts

Showing posts with the label bash

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

Joomla 1.5 Directory Status: Writeable

[UPDATED] Joomla 1.5 is acting flaky on one of our installations because the directories are set to ‘unwriteable’. To see the their current state, log in as Super Administrator and go to Help > System Info > Directory Permissions . Elsewhere, it's been suggested that the specified directories must be set to “world-writeable” (777). This works, but it is a very bad idea , since it means anyone can change your files! Not cool. Fixing Security with User and Group Settings To perform these changes, you need shell (command line) access to your server. If you don't have it, you can beg your host to make these changes for you, or switch to a Joomla-friendly host. I'm going to assume that you are using a LAMP (Linux/Apache/MySQL/PHP) server because if you're not, then ... well, these instructions should work in principle, but the specifics for your server may be quite different. Here's the issue: you, the FTP user, need full access to your files. So does Joomla,...

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...

Custom Bash Prompt How-To

I want to put a current time stamp on my prompt, so I can see when I run a job. From Custom Bash Prompt How-To This How-To is to change the display of your bash prompt permanently. It will give you a list of different strings you can include into your bash prompt such as, the time of day, the date, and many other options. My prompt is already customized in ~/.bash_prompt

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.

Bash Shell Keyboard Shortcuts For Linux Users

Since the keyboard commands for bash are the same no matter what platform you run your bsh shell on (Mac, Windows, Linux, etc.) it pays to learn a few choice command. Here's a great reference: The default shell on most Linux operating systems is called Bash. There are a couple of important hotkeys that you should get familiar with if you plan to spend a lot of time at the command line. These shortcuts will save you a ton of time if you learn them. Here is the List of Bash Shell Keyboard Shortcuts For Linux Users Ctrl + A - Go to the beginning of the line you are currently typing on Ctrl + E - Go to the end of the line you are currently typing on Ctrl + L - Clears the Screen, similar to the clear command Ctrl + U - Clears the line before the cursor position. If you are at the end of the line, clears the entire line. Ctrl + H - Same as backspace Ctrl + R - Let’s you search through previously used commands more , including Alt keys ... Read the rest of the listing at Bash Shell Keyboa...

Notable tar Usages

From the gnu.org site: For example, here is how you might copy a directory's contents from one disk to another, while preserving the dates, modes, owners and link-structure of all the files therein. In this case, the transfer medium is a pipe , which is one a Unix redirection mechanism: $ cd sourcedir; tar -cf - . | (cd targetdir; tar -xf -) Here's a sample: sudo tar cvzf /media/MyBook500-ext3/Volume/home-2007-10-20.tgz /home/