Shell Scripting issues

OK, so basically this is involving the neato hack called iChatStatus. It basically uses either AppleScripts or Terminal commands to automatically update your status custom message on iChat. It works great! Enough of the advertisement. Its designed for customizability and creating your own scripts, so I do that. Right now, I basically have a script which shows my iTunes track if iTunes is open, and my currently active app if iTunes isn’t open. I basically just spliced those two seperate provided scripts into one with a simple if-else command.

Now, to my problem. I recently found another script that displays my uptime. Unfortunately, its a shell script not an applescript. It is:

#!/bin/sh

uptime | awk '{sub(/.*up[ ]+/,"",$0) ; sub(/,[ ]+[0-9]+ user.*/,"",$0);sub(/,/,"",$0) ;print $0}'

and it works fine. (Test it by putting the second longer line into Terminal). I was trying to have AppleScript run this shell script and save the output as a string, which I would then pass to iChatStatus. The problem is that the 3rd line of the command contains quotes ("). Script Editor doesn’t like this as it thinks its the end of the call statement.

So… A long way of putting this, but how can I have it ignore certain quotes in the editing, yet use the quotes in the actual shell script?

Second question (which I haven’t gotten to yet) is how can I save the output from the Shell Command to a string? Can I simply to String1=do shell script “” ? I have a feeling that won’t work.

Thanks

You use a “do shell script” command and you escape the quote. There are so many ways to extract the data you want from the ‘uptime’ command. Here’s one:

Jon


[This script was automatically tagged for color coded syntax by Convert Script to Markup Code]