General TC > Programming & Scripting - Unofficial

[Solved] variable expansion inside a here-file issue

<< < (2/5) > >>

Rich:
Hi aus9

--- Quote from: aus9 on July 15, 2023, 09:40:14 PM ---Please mark as solved. ...
--- End quote ---
Done.  :)

aus9:
Hi Rich sorry full script fails I am going to have to post it.
can you remove solved and in next post I will have to show full output

the end shows
> EOF2
I press enter expecting to return to prompt but what I see is
> EOF2
>

aus9:
server error in attempting to post...so a clickable txt file link to show what I was attempting.

https://www.dropbox.com/scl/fi/bbkk2xfmh4uu555lmp2ye/forum.txt?rlkey=x7utnunbipvdkyrad68w2m8y5&dl=0

ok just spotted that my first echo has multiple double quotes..I will remove and retest
EDIT2 Nope still fails

my brain needs a rest. thanks for reading

Rich:
Hi aus9

--- Quote from: aus9 on July 15, 2023, 11:04:50 PM --- ... can you remove solved ...
--- End quote ---
Removed.  :o

jazzbiker:
Hi aus9,

In Your script You are assigning variables inside the here-file. This is funny and tricky but may cause brain damage )

--- Code: ---tc@box:~$ cat aaa
cat > bbb << EOF2
N=abc
cat > $N << EOF
ls
EOF
EOF2
tc@box:~$ . ./aaa
tc@box:~$ cat bbb
N=abc
cat >  << EOF
ls
EOF

--- End code ---

Can You rewrite Your script at least to move variables definitions out of the here-file fragment?

Welcome to hell scripting!

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version