BBedit a folder

A script that will open the current folder in BBedit browser

    tell app "Finder" to set f to (folder of the front window) as alias
on error -- no open folder windows
    set f to path to desktop folder as alias
end try

tell application "BBEdit 6.5"
    open f
end tell

Edit directory in BBedit

localhost% bbedit directoryName

causes BBedit to open a file browser window on that directory…yeah, I like that.

For the indexor: How do I do the equivalent of an emacs “dired” on a Mac OS X folder if I am using BBedit as my primary editor

For the compatability folks: emacs dirname

fsck on reboot

Using Disk Utility from the startup cd, or booting to single-user mode (hold down command-s just after chime) and at the “#” prompt type “fsck -y” repeat that command until no errors are reported, then type “exit” your mac will continue to boot.

Short-circuit shell commands

mac 131 work % [[ "a" > "A" ]] && echo fred
mac 132 work % [[ "a" > "A" ]] || echo fred
mac 133 work % [[ "a" > "A" ]] && [[ "a" < "n" ]] && echo fred
mac 138 work % foo="9"
mac 139 work % [[ "$foo" < "A" ]] && foo="defaultString"
mac 140 work % echo $foo
mac 141 work % foo=" Some String"
mac 142 work % [[ "$foo" < "A" ]] && foo="defaultString"
mac 143 work %
mac 143 work % echo $foo
mac 144 work % foo="Some String"
mac 145 work % [[ "$foo" < "A" ]] && foo="defaultString"
mac 146 work % echo $foo
Some String
mac 147 work % foo=""
mac 148 work % [[ "$foo" < "A" ]] && foo="defaultString"
mac 149 work % echo $foo
mac 150 work %

basename and dirname

basename and dirname are programs – read process creation. Shell substitution can be much quicker and far more obscure.

basename is ${ARG##*/}


dirname is ${ARG%/*}


Change the prompt in "sh"

I set my prompt in .profile to

PS1="%m %! %c %# "; export PS1

which gives me host – command number – last part of path – # or % depending on root or not…

Reduce Disk Consumption

Get rid of all non-english files in application bundles

find / ! -name "English.lproj" -name "*.lproj" -type d -exec rm -r -- true ;

System Speedups

These things are all one-liners – watch out for the wrap in your browser.

to make window resizing and application load time faster :

sudo renice -20 -p `ps -ax | grep WindowServer | cut -c1-5 | sort | head -1`
pre-bind files in os x (optimize/defragment) :

sudo update_prebinding -root / 

Selective IMPORT from RBR file

From Ian Smith of Oracle:

If you go the EXPORT and IMPORT route then may I recommend the following:


It already generates an IMPORT script.

Modify the IMPORT command to redefine any indices you want to change. IMPORT will replace the definitions in the RBR file with those on the command line. BUT make sure they are defined inside the IMPORT command (i.e. Only one semicolon)

In V7.1 you can RMU/LOAD from the RBR file (V7.1.0.2 and later documented next release 🙂

RMU/LOAD/MATCH_NAME personnel employees pers.rbr

You can then submit batch jobs to load from the RBR after creating the database using IMPORT … NO DATA.