I have a file called fstab.txt which contains:
UUID=86861354-d783-4b9e-a871-e9fbbfc35c22 /mnt/d1 ext4 defaults 1 2
UUID=ffa788ba-0802-4305-ab59-2a34dda3a706 /mnt/d2 ext4 defaults 1 2
UUID=993eec37-9c6d-4ba6-9ed3-77f2d7652256 /mnt/d3 ext4 defaults 1 2
UUID=36817374-0d46-4d5b-ac9b-2229268b0978 /mnt/d4 ext4 defaults 1 2
I want to read the file and generate a hash as below:
hash = {
"UUID=86861354-d783-4b9e-a871-e9fbbfc35c22" => "/mnt/d1",
"UUID=ffa788ba-0802-4305-ab59-2a34dda3a706" => "/mnt/d2",
"UUID=993eec37-9c6d-4ba6-9ed3-77f2d7652256" => "/mnt/d3",
"UUID=36817374-0d46-4d5b-ac9b-2229268b0978" => "/mnt/d4",
}
Currently I am thinking this way:
$output = generate("/bin/cat fstab.txt")
And split out $output.
Some one could guide me a better way to do this.
Thanks in advance.