0
root# dscl . -change /Users/default RealName "Brian" "David"

When running this command in Terminal the Full Name of the user that is associated with home folder "default" is changed from Brian to David.

However when I try to run this command in ScriptEditor I get a syntax error.

do shell script "dscl . -change /Users/default RealName "Brian" "David""

Syntax Error
Any ideas as to how I could correct this ?

Mikhail Kulin
  • 51
  • 2
  • 11

1 Answers1

0

The second double quote breaks the syntax because it indicates the end of the literal shell script argument. You can even see it in the source text (syntax highlighting).

I guess the double quotes around the names are not needed so it's simply

do shell script "dscl . -change /Users/default RealName Brian David"

However if the double quotes are required you have to escape them

do shell script "dscl . -change /Users/default RealName \"Brian\" \"David\""
vadian
  • 274,689
  • 30
  • 353
  • 361
  • Yes, Thank you! The back slashes to esacpe the double quotes resolved the issue. the command now performs the desired action and without syntax error. Also you're correct the double quotes around the names are not needed and the parenthases also not needed. – Mikhail Kulin Jan 13 '17 at 13:41