Archive for the ‘bash’ Category

Bash profile customisation

I have added aliases and other customisations to my bash shell over the last four years to reach a point I’m quite happy with.

Ultimately, I think everyone’s shell will be different as well perform different tasks and have different priorities. (more…)

ARDAgent version

If you administrate a number of Mac clients you’ll no doubt be familiar with Apple’s Remote Desktop. As is the case with most software additional functionality becomes available in new release and ARD is no exception. Hence the ARD client version is a relevant piece of information and when I needed to get the information from a user without using Remote Desktop itself I came up with the following code. (more…)

Selectively emptying a Postfix mail queue

One of the mail servers I manage was blocked up to the hilt with sixteen thousand emails sent to a specific recipient. This meant no one could send or receive email in the office until Postfix had delivered the messages. Only problem was these messages weren’t going anywhere. To make matters worse, the queue contained important emails that had to be delivered! (more…)

New Terminal tab with pwd

Just a quick snippet I’m using to open a new tab in Terminal. It accepts a single, optional argument which will override cd’ing to the working directory.

#!/usr/bin/env bash
 
if [[ $# -eq 0 ]]; then
	dir=`pwd`
else
	dir=$1
fi
 
/usr/bin/osascript \
-e "tell app \"System Events\" to tell process \"Terminal\" to keystroke \"t\" using command down" \
-e "tell app \"Terminal\" to do script \"cd $dir\" in front window" \
-e "tell app \"System Events\" to tell process \"Terminal\" to keystroke \"l\" using control down"

I’ve put the shell script in “/usr/local/bin” as this is in my $PATH. I’ve named the script “tab” so whenever in Terminal I can enter “tab” to open a new tab with the current working directory ready and waiting. Very useful when working with Rails and multiple shells.

Modified CSS Bundle for TextMate

If you use TextMate when you’re coding for the web you’ll probably have at least tried out Jim Jeffer’s CSS Bundle, which was inspired by an article by Jina Bolton. If not check it out!

When I first downloaded it I was impressed but not exactly blown away as the snippets don’t really leverage the true power of TextMate’s bundle system. I had to get to work to make things a lot smoother. (more…)

iTunes and lsof

A while back I wanted to know what people were listening to if they were sharing my iTunes library. I used lsof in a little bash script to find out. (more…)