I am having trouble setting my variables to the correct string in my UNIX shell script. Here is my code ($1 is a filename):
nameIndex=$(echo "$lineCount+3" |bc);
name=$(sed -n -e "$nameIndexp" -e "$nameIndexq" $1);
echo "$name";
When $lineCount is 270, the output is just a new line. That is, $name is not printed or not evaluated.
If $lineCount is 270, I want the output to be
sed -n -e 273p -e 273q filename.txt
which essentially prints the 273rd line of filename.txt
I appreciate your time!