shell拼接命令并執(zhí)行 如何在shell中執(zhí)行字符串拼接起來的命令c?
如何在shell中執(zhí)行字符串拼接起來的命令c?[ 根@localhost~]#a=123您在/var/spool/mail/root[根@localhost~]#b=456[根@localhost~]
如何在shell中執(zhí)行字符串拼接起來的命令c?
[ 根@localhost~]#a=123您在/var/spool/mail/root[根@localhost~]#b=456[根@localhost~]#回聲$a$b123456[根@localhost~]#c=$a$b[根@localhost~]#Echo$c123456
字符串應該放在雙引號中,以防止中間出現(xiàn)空格,例如名稱中的空格。更改為:total=“${name}”“${email}”“${other}”或total=“$name”“$email”$other”