I want to create filesystem on remote machines VIA ssh in my bash script
disk=sdg
the following line is from my bash script
ssh $IP " [[ ` lsblk -f | grep $disk | awk '{print NF}' ` -eq 1 ]] &&
mkfs.ext4 -j -m 0 /dev/$disk -F "
bash: -c: line 0: conditional binary operator expected
bash: -c: line 0: syntax error near `1'
bash: -c: line 0: ` [[ -eq 1 ]] && mkfs.ext4 -j -m 0 /dev/ -F '
while the following syntax will return 1 in case file system not created on disk
lsblk -f | grep $x | awk '{print NF}'
so I just want to perform VIA ssh case if filesystem not created then I will execute the mkfs
is it possible?