Is multi-line assignment to eval possible ?

Manish Jain bourne.identity at hotmail.com
Tue Aug 8 15:48:59 UTC 2017


Hi,

On my FreeBSD box, I was trying do something in a Bourne script which at 
first seemed fairly trivial - but has now clouded my mind thoroughly.

a=A
b=B

eval ${a}_${b}="something"

No problems so far. I get a new variable A_B that stores "something"

But if I spread the assignment over 2 lines as under :

eval ${a}_${b}="some
thing"

The shell barks at me that it could find no command called 'thing'. Is 
there some hack that I could use to get eval to 'understand' that the 
assignment has an embedded newline ?

Thanks for any help.
Manish Jain


More information about the freebsd-questions mailing list