This is simply a collection of several Bash scripts I have found handy in OS X. Many of them were written as experiments in trying to accomplish a simple task as part of a larger script. Many of these bits and pieces came from wisdom gleaned from various forums. YMMV.
Those items listed with ".sh" extensions have been uploaded as ".txt" so they will display in a web browser instead of downloading. If you download one, you'd do well to change its extension from ".txt" to ".sh".
Download all scripts in a single zip file.
| Script Name | Description |
|---|---|
| admin-user-create.sh | Inserts the specified user into the admin group |
| bbman | Opens man pages in BBEdit (or TextWrangler or TextEdit) |
| bc_test.sh | Demonstrates simple bc syntax to perform mathematical computations |
| changedefaults.sh | Universal search/replace in plists |
| copySlow.sh.zip | Very inefficient copy engine - workaround for "MS Office vs. NetFile" copy problems |
| FixFileExtensions.sh | Uses "GetFileInfo" to determine file creator and/or file type and append the appropriate 3-letter extension. Also replaces NetFile-unfriendly characters with dashes. |
| mydate.sh | Echoes one sample date format |
| namefile-unique.sh | Creates a unique filename using `date %s` |
| parameters.sh | Demonstrates how to require a certain number of parameters |
| .profile | Set several aliases and other Terminal niceties. Save it as ".profile" in your home directory and relaunch Terminal (or type `source ~/.profile`) for them to take effect. |
| screensaver.sh | Enable the screen saver for all local users |
| smb.sh | Use mount_smbfs to connect to a Windows filespace |
| touchx | Creates a new executable script and opens it for editing |
| awk '{gsub(/^[ \t]+|[ \t]+$/,""); print}' | Delete BOTH leading and trailing whitespace from each line using awk |
Here's that link I promised to the July 11, 2007 BASH Shell Primer presentation I gave at the MacTeam meeting.
Scott Russell, IT Support Engineer, University of Notre Dame
My Home Page --> www.nd.edu/~srussel2/