Bash version: GNU bash, version 4.4.23(1)-release (x86_64-cros-linux-gnu) command:
file=fileName; line=3;
head -$line $file | tail -1;
In my usage, the above line is constructed by a bash script. How can I put the above command in a bash variable, and then execute it?
cmd='head -$line $file | tail -1;'
To run, $cmd
in back quotes does not work.
Thank you.