Re: [PATCH] udevadm-info: add query for properties with quoted output

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Dec 9, 2010 at 19:03, David Zeuthen <zeuthen@xxxxxxxxx> wrote:
> On Thu, Dec 9, 2010 at 9:26 AM, Â<harald@xxxxxxxxxx> wrote:
>> From: Harald Hoyer <harald@xxxxxxxxxx>
>>
>> $ udevadm info --query=shproperty --name=/dev/sda
>> UDEV_LOG='3'
>> DEVPATH='/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda'
>> MAJOR='8'
>> MINOR='0'
>> DEVNAME='/dev/sda'
>> DEVTYPE='disk'
>> ...
>> DEVLINKS='/dev/block/8:0 /dev/disk/by-id/ata-APPLE_SSD_TS128B_60CS105MT4RZ /dev/disk/by-id/scsi-SATA_APPLE_SSD_TS128_60CS105MT4RZ /dev/disk/by-path/pci-0000:00:1f.2-scsi-0:0:0:0'
>>
>> This enables the use of "eval" in shell scripts:
>> $ eval $(udevadm info --query=shenv --name=/dev/sda)
>> $ echo $DEVLINKS
>> /dev/block/8:0 /dev/disk/by-id/ata-APPLE_SSD_TS128B_60CS105MT4RZ /dev/disk/by-id/scsi-SATA_APPLE_SSD_TS128_60CS105MT4RZ /dev/disk/by-path/pci-0000:00:1f.2-scsi-0:0:0:0
>
> Would be nice if you could prefix the resulting environment variables e.g.
>
> Â$ eval $(udevadm info --query=shenv --shprefix=MY_NAMESPACE --name=/dev/sda)
> Â$ echo $MY_NAMESPACE_DEVLINKS
> Â/dev/block/8:0 /dev/disk/by-id/ata-APPLE_SSD_TS128B_60CS105MT4RZ
> /dev/disk/by-id/scsi-SATA_APPLE_SSD_TS128_60CS105MT4RZ
> /dev/disk/by-path/pci-0000:00:1f.2-scsi-0:0:0:0
>
> to ensure that no existing variables gets overwritten. You probably
> also want to patch the man pages.

There is already --export, and --export-prefix for 'udevadm info'.
That can probably be re-used.

I think, the quotes we can just always unconditionally add, when we
have whitespace in the value.

Kay
--
To unsubscribe from this list: send the line "unsubscribe linux-hotplug" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel]     [Linux DVB]     [Asterisk Internet PBX]     [DCCP]     [Netdev]     [X.org]     [Util Linux NG]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux