• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Spaces in shell script paths
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Spaces in shell script paths


  • Subject: Re: Spaces in shell script paths
  • From: Adrian <email@hidden>
  • Date: Thu, 28 Mar 2002 17:51:59 -0500

There are several ways to solve your problem. You can hide the \ from applescript by changing it to \\.
do script "cd /Applications/HOBLink\\ JWT"
then the shell sees:
/Applications/HOBLink\ JWT
Alternatively, yet similarly, you can quote the path, like so:
do script "cd \"/Applications/HOBLink JWT\""
Also, you could create a shell script file and call that from Applescript
The best way, though, is probably to get Apple's Developer Kit (free with registration from developer.apple.com) and use MJRAppBuilder to create an OS X application package from the class/jar files, which would then be double clickable, could have custom icons, etc.
By the way, you don't need to use application "Terminal"; you can run scripts directly using:
do shell script "command ... "
This will be faster, since you won't wait for Terminal to launch and it uses the relatively light weight zsh instead of tcsh
if you have multiple commands, you can a) shove them in a shell script file or b) string them together, like so:
do shell script "cd /whatever && java main_class && something else ....."
( a && b means execute b upon success of a, c || d means execute d upon failure of c, e & f means execute e and f simultaneously. Sorry, I don't know your skill level with UNIX.)

Hope that helps.

-- Adrian

On Thursday, March 28, 2002, at 01:57 PM, Phillip Burk wrote:

OK, I apologize if this has been discussed here, but this is driving me
batty.

I'm attempting to script the launching of Java app that has to be run from
the command line. I get sick of typing it every day/more than every day.

Here's the syntax:

tell application "Terminal"
activate
do script with command "cd /Applications/HOBLink JWT"

<MORE STUFF HERE>

end tell

This script will compile and run but returns an error in Terminal because
the space is not preceded by a '\'. If I try to insert a '\' in the do
script with command line where it's needed, the script won't compile.

Now how do I denote spaces in a 'do script' line so that Terminal doesn't
barf?

Phil Burk
_____________________________________________________________
Intermediate Systems Support Technician
Hungry Minds, Inc.
317.572.3049

[Now jamming: "It's Not The Night" by The Cars]
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Spaces in shell script paths
      • From: Bill Hoffman <email@hidden>
References: 
 >Spaces in shell script paths (From: Phillip Burk <email@hidden>)

  • Prev by Date: Re: Error-trapping alias properties
  • Next by Date: AppleScript from shell?
  • Previous by thread: Spaces in shell script paths
  • Next by thread: Re: Spaces in shell script paths
  • Index(es):
    • Date
    • Thread