At 04:23 -0700 10/08/2012, Marc Reavis wrote: >I'm new to shell scripting, and have run into a problem with an early effort. >The script is very simple: it creates a file in one location, writes >information to it, performs > >ls -la ~/Documents, > >appends the result to the file, moves the file to a second location, >appends information to the file, opens the file in BBEdit, sleeps 10 >seconds, then closes the file. >That's the desired result. I can do everything except close the file once >it's open in BBEdit. >What's the solution? Is it using kill? [...]
For this purpose, I'd use the 'osascript' shell command to execute a short, inline AppleScript telling BBEdit to close the active document [i.e. your file]. Here's an example using an in-line command: osascript -e "tell application \"BBEdit\" to close text document 1" or if you needed to do anything more complicated, you could store the AppleScript in a file and execute that -- see 'man osascript' for details. (PS: You don't want to use 'kill' here since it works only on processes, i.e. applications themselves.) Regards, Patrick Woolsey == Bare Bones Software, Inc. <http://www.barebones.com/> -- -- You received this message because you are subscribed to the "BBEdit Talk" discussion group on Google Groups. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at <http://groups.google.com/group/bbedit?hl=en> If you have a feature request or would like to report a problem, please email "[email protected]" rather than posting to the group. Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>
