Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fwd: AS and shell



Meant to send this to the list. . .


On 11/30/06, Mark J. Reed <email@hidden> wrote:
On 11/30/06, Jay Louvion <email@hidden> wrote:
>
>
>  Hi all, I'm trying to script a shell that includes variables as follows:

Sorry, I'm going to ask you to back up and clarify what you're trying
to do here.

>  #!/bin/sh
>  export
> PATH="/opt/darwinports/bin:/bin:/sbin:/usr/bin:/usr/sbin"
>  id >> "$1/buildimage.log"
>  date >> "$1/buildimage.log"
>  rm -rf "$3"
>  dvdauthor -o "$3" -x "$2" 2>> "$1/buildimage.log"
>  mkisofs -dvd-video -o "$1/$5.iso" -volid "$5 DVD" "$3" "$4" 2>>
> "$1/buildimage.log"
>  rm -rf "$3"

That's not a shell, that's a shell *script*.  The "shell" is the
program that executes it (in this case, /bin/sh).  So I don't know
what you're trying to do when you say you want to 'script" the above.
If you save those lines exactly as-is to a file somewhere, and turn on
execute permission on that file (via chmod +x /path/to/the/file), then
you can run it from AppleScript with something like this:

do shell script "/path/to/the/file " & quoted form of valueForDollar1
& " " & quoted form of valueForDollar2 & " " & quoted form of
valueForDollar3 & " " & quoted form of valueForDollar4

If your goal is to get the equivalent of running that shellscript
without having to store it in a file first, well, I'd recommend
translating the program to AppleScript using as few shell commands as
possible, and then run those with individual "do shell script"?

To go back to the original question: does this not work as intended?

do shell script "some command " & return & "some other command"

If not, you can always use a semicolon instead, as Michell suggested.
Although there are minor differences between semicolon and newline in
delimiting shell commands, they're unlikely to come up.

--
Mark J. Reed <email@hidden>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-users/email@hidden
Archives: http://lists.apple.com/mailman//archives/applescript-users

This email sent to email@hidden
References: 
 >AS and shell (From: Jay Louvion <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.