read the first line in a file, given the file path in BASH
You can do the following:
var=$(cat /x/y/z/file.txt)
The above command will print the file and assign the output to the var variable.
Another thing you can do, if you want to explicitly grab only the first line:
var=$(head -1 /x/y/z/file.txt)