User Tools

Site Tools


action:Execute_a_Shell_Script

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
action:Execute_a_Shell_Script [2023/09/18 02:35]
peternlewis [Output of Results]
action:Execute_a_Shell_Script [2023/09/22 04:39] (current)
peternlewis [Quoting Strings]
Line 173: Line 173:
 It is bash that has processed the variable substitution for $KMVAR_witchPref,​ split the line in to seven parts, processed the backslash in "​Application\ Support"​ and then executed the defaults tool with the seven parts as arguments (the command itself is the 0th argument, normally mostly ignored by tools). It is bash that has processed the variable substitution for $KMVAR_witchPref,​ split the line in to seven parts, processed the backslash in "​Application\ Support"​ and then executed the defaults tool with the seven parts as arguments (the command itself is the 0th argument, normally mostly ignored by tools).
  
-So the problem is that the word-breaking,​ variable substitution,​ de-quoting and de-backslash is all happening ​at as the line is processed by bash, after which you are left with quotes from within variable substitution,​ but they no longer have any meaning, they are just characters.+So the problem is that the word-breaking,​ variable substitution,​ de-quoting and de-backslash is all happening as the line is processed by bash, after which you are left with quotes from within variable substitution,​ but they no longer have any meaning, they are just characters.
  
 So variables that are meant to be a single parameter should be surrounded by double quotes in the line, but not contain quotes in the variable, and generally you do not want to pass multiple parameters within a single parameter. ​ So instead, perhaps set one variable to the setting name, and one variable to the type and one variable to the value, and then use a command like this: So variables that are meant to be a single parameter should be surrounded by double quotes in the line, but not contain quotes in the variable, and generally you do not want to pass multiple parameters within a single parameter. ​ So instead, perhaps set one variable to the setting name, and one variable to the type and one variable to the value, and then use a command like this:
action/Execute_a_Shell_Script.txt ยท Last modified: 2023/09/22 04:39 by peternlewis