C 处理特殊字符

Oracle Enterprise Performance Management Cloud 密码、代理密码和命令参数值可能包含特殊字符。需要进行特殊处理,EPM Automate 才能处理此类字符。

本节中的示例使用示例密码来说明如何使用特殊字符。

Oracle 建议您使用双引号将参数和值对括起来。

Windows

必须使用双引号 (") 括住特殊字符或包含特殊字符的参数值对这些特殊字符进行转义。

注:

不能从名称中包含 & 的文件夹运行 EPM Automate;例如 C:\Oracle\A&B

表 C-1 特殊字符处理:Windows

字符 说明 转义示例
) 右括号
  • Example")"pwd1
  • "Example)pwd1"
< 小于
  • Example"<"pwd1
  • "Example<pwd1"
> 大于
  • Example">"pwd1
  • "Example>pwd1"
& & 符号
  • Example"&"pwd1
  • "Example&pwd1"
| 竖线
  • Example"|"pwd1
  • "Example|pwd1"
" 引号
  • Example"""pwd1
  • "Example"pwd1"

在 Windows 批处理文件中的明文密码中使用感叹号

在用于 EPM Automate 的 Windows 批处理文件中的明文密码中使用感叹号 (!) 时,应按如下所示进行处理:

  1. 在感叹号之前使用两个脱字号 (^^) 作为转义字符。例如,如果密码为 Welc0me!,则将其编码为 Welc0me^^!
  2. 通过包括以下声明,更新批处理文件以在文件开头设置 DisableDelayedExpansion:

    setlocal DisableDelayedExpansion

  3. 删除脚本中的 setlocal EnableExtensions EnableDelayedExpansion 声明(如果存在)。

UNIX/Linux

在 UNIX 和 Linux 操作系统上,必须使用反斜杠 (\) 对这些特殊字符进行转义。

注:

  • 要对 !(感叹号)进行转义,请用单引号将密码引起来或者使用反斜杠 (\) 作为转义符。
  • 要对 \$'" 进行转义,请用双引号将密码括起来或者使用反斜杠 (\) 作为转义符。

表 C-2 特殊字符处理:UNIX/Linux

字符 说明 转义示例
( 左括号 Example\(pwd1
) 右括号 Example\)pwd1
< 小于 Example\<pwd1
> 大于 Example\>pwd1
` 撇号 Example\'pwd1
! 感叹号
  • 'Example!pwd1'
  • Example\!pwd1
# 井号 Example\#pwd1
& & 符号 Example\&pwd1
| 竖线 Example\|pwd1
; 分号 Example\;pwd1
. 句点 Example\.pwd1
" 引号
  • Example\"pwd1
  • "Example\"pwd1"
' 单引号
  • Example\'pwd1
  • "Example\'pwd1"
$ 美元符号
  • Example\$pwd1
  • "Example\$pwd1"
\ 反斜杠
  • Example\\pwd1
  • "Example\\pwd1"

在 UNIX 或 Linux 脚本中的明文密码中使用感叹号

在 UNIX/Linux 脚本中,如果存储在 shell 变量中的 EPM Automate 密码包含特殊字符,请使用三个反斜杠作为转义序列,然后用双引号将字符串括起来。例如,包含在 shell 变量 password 中的密码 lzi[ACO(e*7Qd)jE 应当按如下方式编写脚本:

password="lzi[ACO\\\(e*7Qd\\\)jE"