79131246

Date: 2024-10-27 18:41:57
Score: 3.5
Natty:
Report link

I have a related question to my original post:

Suppose in the terminal window I entered the following;

doc_path="/Users/joeblogs/My Files/Documents/"

file3_L="$doc_path/txt/Testfile.txt"

echo $file3_L

which outputs:

/Users/joeblogs/My Files/Documents/txt/Testfile.txt

and then I enter;

n=3

left="file${n}_L"

echo $left

which outputs:

file3_L

Issue:

I can't seem to get the same output as I got from using echo $file3_L by instead using the value of $left - is there something I am missing in terms of the bash syntax / brace expansion?

What I would like to get (by using $left in some way) is:

/Users/joeblogs/My Files/Documents/txt/Testfile.txt 

This will help with the my original goal(s).

Any help/advice is much appreciated.

Thanks.

Reasons:
  • Blacklisted phrase (0.5): Thanks
  • Blacklisted phrase (1): appreciated
  • Blacklisted phrase (1): Any help
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: TheEngineer