我实际上使用的是一个小脚本,这个脚本使用来自NAS EMC Storage的命令,主要思想是存储和输出变量,并将其用于其他命令。
nameserver="$(nas_server -list -all | awk 'NR == 3 {print $6}')"
serverparam1="$(server_param "$nameserver" -facility NDMP -list)"
echo "$serverparam1"
所以..这个命令nas_server -list -all | awk 'NR == 3 {print $6}
返回" server_3"
这个想法是存储名称" server_3"并在其他命令中使用它:
server_param server_3 -facility NDMP -list
所有这些问题的问题在于输出打印不是" server_3"只得到" ver_3"我不知道为什么会这样。
这是终端的输出:
[nasadmin@xxxx ~]$ ./test.sh
: ver_3
: unknown hostver_3
这是server_param
的输出 [nasadmin@xxxx ~]$ server_param server_3 -facility NDMP -list
server_3 :
param_name facility default current configured
maxProtocolVersion NDMP 4 4
scsiReserve NDMP 0 0
DHSMPassthrough NDMP 0 0
CDBFsinfoBufSizeInKB NDMP 1024 1024
noxlt NDMP 0 0
bufsz NDMP 128 128
convDialect NDMP 8859-1 8859-1
concurrentDataStreams NDMP 4 4
includeCkptFs NDMP 1 1
md5 NDMP 1 1
snapTimeout NDMP 5 5
dialect NDMP
forceRecursiveForNonDAR NDMP 0 0
excludeSvtlFs NDMP 1 1
tapeSilveringStr NDMP ts ts
portRange NDMP 1024-65535 1024-65535
snapsure NDMP 0 0
v4OldTapeCompatible NDMP 1 1
[nasadmin@xxxx ~]$ nas_server -list -all
id type acl slot groupID state name
1 1 0 2 0 server_2
2 4 0 3 0 server_3
id acl server mountedfs rootfs name
1 0 1 17 13 TEST_VDM-1
2 0 1 16 14 TEST_VDM-2
由于
答案 0 :(得分:1)
这对我有用
nameserver="$(nas_server -list -all | awk 'NR == 5 {print $6}')"
nameserver1="$(dos2unix $nameserver)"
serverparam0="$(server_param "$nameserver0" -facility NDMP -list)"
echo "$serverparam0"