Tuesday, March 29, 2005

Bash Scripting: Tip of the Day!

I know that we all love and hate shell scripting. Bash can be the best friend in the world at times, then the worst enemy a second later. While working on a parsing script today, I came across a problem where I wanted to be able to pass an argument to a shell script, then use that argument in some processing. The only problem was, I needed to be able to pass arguments that had multiple words and spaces! I have come across this problem before and worked around it, but today I decided to solve the problem and figure out how to work with it.

In order to pass an argument to a shell script on the command line that is not all one word, you must enclose the command line argument in single quotes and the $1 variable in the code in double quotes. An example:

myEcho.sh
------------------

#!/bin/bash

echo "$1"

Execution:
-----------------

non-root@localhost$> ./myEcho.sh 'hello my loyal blog readers'
hello my loyal blog readers

I hope that this tip helps someone looking for the same thing.

Wednesday, March 23, 2005

Mac OS X Security

Computer Crime Research News has an article where they discuss an article by major Anti-virus vendor Symantec which talks about how Mac OS X is increasing in popularity and becoming a target of hackers. This discussion is excellent for the security industry and those who would like to see more variety in the operating systems deployed on the desktop. With BSD and Mac OS X being rated as the most secure OS for either 2003 or 2004 (I forgot the link, I'll try to find it), we will now be able to see how secure it is. We will also be able to see how secure the applications that Apple has added to the BSD system are and how viable the Apple solution is compared to Linux [and Microsoft Windows].

I don't think that the vulnerabilities will ever match, or come close to matching what we have seen with Microsoft products. The reasoning for this is that Microsoft has been in the spotlight for many years as the front-runner, while the other boys have stood by the way-side learning and moving in a more secure fashion while learing from the mistakes and successes of Microsoft. It is much better to have options when deploying a server or desktop, so I welcome the competition of Microsoft, Apple, and any other OS vendor. I do like to preach about open-standards though, and the consumer should not have to be the one struggling to implement a solution because the vendor has gone out of their way to prevent interoperability (read Microsoft).