我想提取远程计算机的连接的iSCSI设备
dev_by_path="/dev/disk/by-path/ip-10.1.1.240:3260-iscsi-iqn.2013-12.com.ryussi:swift1-lun-0"
DEVICE=`ssh -i key.pem root@10.0.0.2 'bash -s' << 'ENDSSH'
basename $(readlink $dev_by_path)
ENDSSH`
它提供了错误:
readlink: missing operand
Try `readlink --help' for more information.
basename: missing operand
Try `basename --help' for more information
但是,如果我这样做
DEVICE=`ssh -i key.pem root@10.0.0.2 'bash -s' << 'ENDSSH'
basename $(readlink "/dev/disk/by-path/ip-10.1.1.240:3260-iscsi-iqn.2013-12.com.ryussi:swift1-lun-0")
ENDSSH`
那么它成功执行和echo $DEVICE
给sda
。 我应该如何执行此。