Subjectively

dd if=/dev/random | kirk > blog

Subjectively header image 4

Entries Tagged as 'OS X'

bash shell script to manage pid file creation/deletion

October 30th, 2009 · 1 Comment · Linux, OS X

You want your script to execute without overlapping another execution.

[Read more →]

Tags:

bash shell script to use getopts with gnu style long positional parameters

October 29th, 2009 · 1 Comment · Linux, OS X

Problem: You want to support –really-long-option-names in your bash script and getopts won’t do it. More problems: You don’t want to use getopt because you want cross platform support or your platform isn’t supported. More problems than that: I can’t help with existential issues. Solution: Rewrite the long options into short options and then use [...]

[Read more →]

Tags:

sed script to trim leading and trailing spaces

February 25th, 2009 · No Comments · Linux, OS X

i couldn’t find this anywhere, so just to make it generally public, this is my trim function: sed ‘s/^[[:space:]]*\(.*\)[[:space:]]*$/\1/’ For who’s looking, this command says: from beginning of line ^ take any amount of whitespace [[:space:]] then create a group containing anything \(.*\) up to whitespace at the end of the line [[:space:]]*$ replace this [...]

[Read more →]

Tags: