read shell into property, pass to do shell script?
read shell into property, pass to do shell script?
- Subject: read shell into property, pass to do shell script?
- From: Star <email@hidden>
- Date: Fri, 3 Oct 2003 10:42:58 -0400 (GMT-04:00)
Hello,
How is the best way to read a shell script into a
property, therefore embedding it, and then pass it to
do shell script without using the original text/shell file?
Info below is where I'm at and what I've been trying
including how I have tried to read it in.
Randy Writes:
>
> Have you tried putting your code into an actual shell
>
> script and then calling that script?
Yes, that was my next thought as I was beating my
brains out last night. I took my variables expressed into
posix etc. separated them from the shell script and
illicited the result. The result was perfectly fine. There
was truly no problem with the paths at all.
set x to quoted form of POSIX path of TestFile & " " & ?
quoted form of POSIX path of LogFile)
result
"'/Applications/TestFiles/TestFile' '/Applications/TestFiles/LogFile'"
so paths were fine. Then I made a full path to the shell
script as opposed to reading it into a property and passing
it as a string to the (do shell script) It worked fine. So,
I thought it was paths but all along it was really something
to do with the script read in as a string property.
do shell script (quoted form of POSIX path of myShellStuffPath & " " & ?
quoted form of POSIX path of TestFile & " " & ?
quoted form of POSIX path of LogFile)
That works great, so now the problem has to be how the
script itself is being read in and set to a property as string?
property myShellStuff: ""
if myShellStuff = "" then
try
close access alias myShellStuffPath
end try
set myShellStuff to read alias myShellStuffPath from 1 to (get eof alias myShellStuffPath)
end if
set myShellStuff to myShellStuff as string
do shell script (myShellStuff & " " & ?
quoted form of POSIX path of TestFile & " " & ?
quoted form of POSIX path of LogFile)
result = sh test_file log_file
So, if I go and run this shell script from the terminal, and I
don't pass the arguments of "test_file" & "log_file" I will get
same result, or error. That's why I assumed the property
was working fine.
_______________________________________________
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.