I am trying to write a dd migration script that will do the following:
- read user input (max=4) into an array, called "array". the user will enter the logical volume names to be migrated.
- once each element is stored on an array, run:
/sbin/lvscan | grep -E '"array[0]"|"array[1]"|"array[2]"|"array[3]"’
- spawn multiple ssh connections to migrate each logical volume via dd to a specific host, the IP of which is also entered by user and stored in a variable.
I currently have:
#!/bin/bash
echo "Enter upto 4 SRVID's seperated by a space"
while read SRVIDS
do
[ "$SRVIDS" == "done" ] && break
array=("${array[@]}" $SRVIDS)
done
/sbin/lvscan | grep -E '"array[0]"|"array[1]"|"array[2]"|"array[3]"' 2&>1
What am I doing wrong? I am unable to get grep for the logical volume paths.
$
in front of their names.