Добрый вечер
# blkid | grep sd | cut -c 1-8 | uniq
/dev/sda
/dev/sdc
/dev/sdd
/dev/sdb
{
"data":[
{"{#HARDDISK}":"/dev/sda"},
{"{#HARDDISK}":"/dev/sdc"},
{"{#HARDDISK}":"/dev/sdd"},
{"{#HARDDISK}":"/dev/sdb"}
]
}
#!/bin/bash
echo "{\"data\":["
array=( `blkid | grep sd | cut -c 1-8 | uniq` )
printf {\"{#HARDDISK}\":\""%s\"},\n" "${array[@]}"
echo "]}"
{"data":[
{"{#HARDDISK}":"/dev/sda"},
{"{#HARDDISK}":"/dev/sdc"},
{"{#HARDDISK}":"/dev/sdd"},
{"{#HARDDISK}":"/dev/sde"},
{"{#HARDDISK}":"/dev/sdf"},
{"{#HARDDISK}":"/dev/sdb"},
{"{#HARDDISK}":"/dev/sdg"},
]}