0

I'm using the following command to get a mount point from a disk:

do shell script "diskutil info /dev/disk4s1 | sed -n 's/.*Mount Point: *//p'"

however if I have two disks with the same name it returns the second one as something like this:

"/Volumes/myDisk 1"

I would like to get the following output:

"/Volumes/myDisk\\ 1"

how can i do this using Applescript-objc?

2
  • 3
    Probably be easier to just use quoted form of. Commented Nov 12, 2022 at 2:09
  • Try adding | sed 's/ /\\\\\\\\ /g' to the end of the shell pipeline. Yes, that's eight backslashes, because AppleScript will interprets them (effectively removing half of them) before passing them to the shell, the shell leaves them alone because they're in single-quotes, but then sed runs them through another layer of interpretation-and-removal, halving the number again... so you need to start with four backslashes for every one you want to come out at the end. Commented Nov 12, 2022 at 2:31

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.