shell拼接命令并执行 如何在shell中执行字符串拼接起来的命令c?

如何在shell中执行字符串拼接起来的命令c?[ 根@localhost~]#a=123您在/var/spool/mail/root[根@localhost~]#b=456[根@localhost~]

如何在shell中执行字符串拼接起来的命令c?

[ 根@localhost~]#a=123您在/var/spool/mail/root[根@localhost~]#b=456[根@localhost~]#回声$a$b123456[根@localhost~]#c=$a$b[根@localhost~]#Echo$c123456

字符串应该放在双引号中,以防止中间出现空格,例如名称中的空格。更改为:total=“${name}”“${email}”“${other}”或total=“$name”“$email”$other”