Archive for the 'Shell Script' Category
Saturday, August 9th, 2008
I discovered an anomaly in mounting a windows samba share through the terminal or a script. If the path has empty spaces in it, you cannot write your path like this:
smb://windowsDisk/foler\ to\ mount/
Nor can you you use quotes to make sure the path is ok
“smb://windowsDisk/foler to mount/”
You have to use url encoded strings:
smb://windowsDisk/foler%20to%20mount/
This has changed [...]
Posted in Shell Script, Unix | No Comments »
Monday, January 28th, 2008
I needed a script to backup a workfolder to a Windows network server. I wrote this perl script that can be triggered using cron. First create a mount point. I used /smb/public. So to do so in two steps, mkdir /smb, then mkdir /smb/public. I put my scripts in ~/bin. Put this perl script below [...]
Posted in Mac OS X general, Perl, Shell Script, Unix | No Comments »
Saturday, February 24th, 2007
May seem simple to most folks, but just in case you are looking for an expression to remove the path before a file name here is an expression to start.
[\w/]*/
It searches for all the word characters before the last slash. If you need periods in the path add those to the character class.
Posted in Mac OS X general, Perl, Shell Script, Unix | No Comments »
Thursday, July 27th, 2006
A while back I wrote a post about a ftp shell script. A number of people told me I should use curl instead. Here is one I wrote using both perl and curl to move some files from a site. I start with a list of file names. They don’t have the .pdf extension in [...]
Posted in Mac OS X general, Perl, Shell Script, Unix | Comments Off
Thursday, April 13th, 2006
Javascript has come a long ways. The Mozilla project has released a couple of tools for javascript writers. I recently added the capability to my Mac of being able to write javascript then run and debug it from the command line, just like I would a perl script. Rhino is a java tool that will [...]
Posted in General, Mac OS X general, Shell Script, Unix | No Comments »
Saturday, March 11th, 2006
I have several handy applications that I use on my mac daily. Obviously a mail app and browser. Safari is very nice. I’m using Apple Mail, but Thunderbird is really a nice mail app, too. But for me, much of the business of computing is storing information, and being able to get to that information [...]
Posted in General, Mac OS X general, Perl, Shell Script, Unix, wordress | No Comments »
Sunday, February 26th, 2006
Recently I wrote about getting Tomcat running in Mac OS X. You can easily start it up manually anytime you want by running the startup script in /Library/Tomcat/bin after you have it installed. But if you want it or any other daemon to run at startup you can use launchd if you are running Tiger. [...]
Posted in Apache, General, Shell Script, Unix | No Comments »
Thursday, January 26th, 2006
I have occasion to look for various text inside of files in a directory. Grep is great for that. To look for some text in a whole directory of files you can type on the command line grep matchtext *.txt. That will pull up the files with the matched text and print it out on [...]
Posted in General, Shell Script, Unix | No Comments »
Tuesday, January 24th, 2006
Do you ever need to move a bunch of files to a specific location? Or do you want to backup certain files and need a nice method for moving them to a second drive or location? This following script can be helpful. You can re-write it for your particular purpose. I originally wrote it to [...]
Posted in Applescript, General, Mac OS X general, Shell Script, Unix | No Comments »
Monday, January 23rd, 2006
I’ve been asked this a couple of times, so I’m revisiting this topic (see post 50). I didn’t think it would have been too common for people to want to restart classic from a script, but apparently there are some. If this doesn’t interest you, at least you might want to take a peek at [...]
Posted in General, Mac OS X general, Shell Script, Unix | No Comments »
Thursday, July 14th, 2005
Previously I showed a php script to send email. You can use php as a shell language as well as a web development language. PHP has ready made functions for this, so it is kind of an easy thing to do. Here is an example of a straight email shell script using bash.
#!/bin/bash
sendmail=”/usr/sbin/postfix”
recipient=”user@domain.com, user2@domain2.com”
( cat [...]
Posted in General, Shell Script, Unix | 3 Comments »
Wednesday, March 16th, 2005
If you have BBEdit and you have installed the command line tool you have a real nice resource for printing lists of file directories. Even without the command line you can drag a directory into a BBEdit window and create a file list of that directory. With the command line tool you can pipe standard [...]
Posted in General, Shell Script, Unix | 1 Comment »
Monday, February 21st, 2005
I like to have a local copy of my website. With Wordpress, I write directly into my hosted site. So I have to occassionally ftp my host site to my local drive to keep them in sync. I have asked my site host to backup my sql database weekly. Then I can download it to [...]
Posted in General, Shell Script, Unix | 6 Comments »
Thursday, February 10th, 2005
I use vi for editing my httpd.conf and other config files as well as for some c programming and shell programming. One of the things I never really used well was the interaction with the shell inside of vi. If you are like me and quit vi to do some shell commands and then reopen [...]
Posted in General, Shell Script, Unix | 1 Comment »
Monday, January 17th, 2005
In the terminal, if you find yourself needing to move back and forth between two directories and don’t want to type in the complete path name constantly, you can either set up aliases of the cd command to the directory or you can use pushd. Let’s say you are in your Sites folder in [...]
Posted in General, Shell Script, Unix | No Comments »
Monday, January 10th, 2005
I have been having a lot of difficulty using Moveable Type in recent weeks. This has slowed progress on the website. I’ve made the switch to Wordpress which is a php alternative to the perl powered Moveable Type. I have found it to be a very nice editor that is very easy to install and [...]
Posted in General, Mac OS X general, Shell Script, Unix | 4 Comments »
Wednesday, November 17th, 2004
Here is a shell script you can use to shutdown and restart classic. I created this to run as a cron script, so that I could shut down classic at an interval. It seemed like Classic was having memory problems if it ran too long without a reboot, so I set it up to run [...]
Posted in General, Mac OS X general, Shell Script, Unix | 3 Comments »
Thursday, October 7th, 2004
I’ve been trying to understand the mount command in Unix. If anyone can shed some light on it, please do post. This is what I have figured out. You can mount an afp volume using the command mount -t afp. But you first have to establish a share point for the mount to land. So [...]
Posted in General, Mac OS X general, Shell Script, Unix | 1 Comment »
Thursday, August 26th, 2004
One thing that OS X is lacking that I used all of the time in OS 9 is the print window command in the finder. There are a few ways to get around this limitation. One way is to open the window you want a print out of. Grab the icon at the top middle [...]
Posted in General, Mac OS X general, Shell Script, Unix | No Comments »
Monday, August 16th, 2004
Apple has provided a command line utility to match the Aqua software update. This can be scripted to run and also can be run remotely using ssh.
I ran the softwareupdate command by typing in softwareupdate -i -r for install required. The discovery of this command line command is really rather nifty. Next time you need [...]
Posted in General, Mac OS X general, Shell Script, Unix | No Comments »