Do Shell Script to unzip on M1 Mac with spaces in path name

Mike Matthews - Omnis omnis at lineal.co.uk
Mon Nov 28 12:40:12 UTC 2022


Hello All,

I’m trying to use a Shell Script to unzip a file on an M1 Mac.  When I use the $runapplescript() command, it errors.

The problem is the path, it has spaces in the folder names.

If I move the Zip file up, where there are no spaces in the folder names, all is good, mostly.  I do get this error:
Expected “"” but found unknown token.

I have tried escaping the spaces with %20, single \ and double \\, all to no joy.

If I paste the same command into Terminal, all is good, when I use the singe \ char as the escape code, I can use the CD command and then Unzip.

So how do you deal with the spaces properly?

This is good:
tell application "Terminal"
do script "cd /Users/mike/Library; unzip -o studioworks.zip"
end tell

But this fails:
tell application "Terminal"
do script "cd /Users/mike/Library/Application\ Support/SQLWorks/SQLWorks\ v10221-31840\ Dev/Lineal\ SQLWorks\ Startup/Lineal\ SQLWorks\ Folder; unzip -o studioworks.zip"
end tell

I have also tried this script using ShellScript from the Finder, still the same issue:
tell application "Finder"
do shell script "cd /Users/mike/Library/Application\ Support/SQLWorks/SQLWorks\ v10221-31840\ Dev/Lineal\ SQLWorks\ Startup/Lineal\ SQLWorks\ Folder; unzip -o studioworks.zip"
end tell

Thanks

Mike Matthews

Lineal Software Solutions
Commercial House, The Strand<x-apple-data-detectors://1/1> Barnstaple, Devon, EX31 1EU<x-apple-data-detectors://1/1>

omnis at lineal.co.uk<mailto:mike.matthews at lineal.co.uk>

www.lineal.co.uk<http://www.lineal.co.uk/>

www.sqlworks.co.uk<http://www.sqlworks.co/>





More information about the omnisdev-en mailing list