Thursday, July 19, 2018

#1 2003-06-06 07:41:53 am

Ray Barber
Site Admin
From:: Lake Dallas, Texas
Registered: 2002-11-20
Posts: 348

Shell scripting example.

I found this at Mac OS X Hints and thought it was a fine example of shell scripting. This particular example is used to make backups of certain game files, but could easily be seasoned to your tastes. BTW, backup often, and backup twice :-)

OS version: OS X


set right_now to do shell script "date | awk '{print $1,$2,$3,$6,$4}'"
do shell script ¬
"cd ~/Documents/\"Agent Backups\"/ ; tar cvf \"" & ¬
right_now & ".tar\" *.usr ; gzip \"" & right_now & ".tar\""
-- the next three lines are one long line, but you'll have
-- to manually combine the last two segments, as you can't
-- put an AppleScript line break in a shell command!
do shell script ¬
"cp \"/Applications/Games/Uplink 1.0.0/Users/\"*.usr
~/Documents/\"Agent Backups\"/"

launch application "TextEdit"

Ray Barber
Admin | MacScripter



Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)