AnsweredAssumed Answered

vanishing escaping characters and mounting shares

Question asked by fclark on Aug 31, 2016
Latest reply on Aug 31, 2016 by David Moyer

objective: I have had a applescript that has been run natively to mount shares. I am trying to get it to work as a calculated applescript.


Assumption: I blame the number of escape character slashes as the variable that is failing my script.


the snippet of native applescript that works:

set mountedVolumes to every paragraph of (do shell script "mount | awk -F' on ' '{print $2}' | awk -F' \\\\(' '{print $1}'")


When I reconstruct this as a variable to be used as a shell script, what I find is I do not have complete control over how many slashes appear in the result of the "set variable" dialog.


"mount | awk -F' on ' '{print $2}' | awk -F' \\\\(' '{print $1}'"

will return

Set Variable [ $shellScript ; Value: "mount | awk -F' on ' '{print $2}' | awk -F \\\(' '{print $1}'"]


Given the number of slashes that I include they may or may not be reduced by 1 when I close the dialog.

If I put in 4 slashes as the original script had. Only 3 will show after closing the dialog.

If I put in 2 slashes it goes down to 1 slash.

if I put in 3 slashes it stays at 3 slashes

If I put in 5 slashes it stays at 5. (until execution)


On execution the debugger tells a different story. If I put in 5 and I execute the script - only 3 show up when the variable $shellScript is evaluated


Can you help me understand this behavior/ get this to work as a calculated script?