How to define a variable as a block of text, nicely


I have a block of text, about three sentences, that I want to get into a variable so I can write it out to a file. I can just do:

$text = "my three sentences" Add-content $myfile $text 

The problem is, creating the $text in a script file is a bit messy. Is there a way to do it so it doesn’t go all the across the screen? I suppose I could put each sentence into a variable and then concatenate them, but I was look for something like splatting, but couldn’t get it to work…

To populate $text, I tried:

$text = @{"my text was here"} 

But multiple lines (to look nice) doesn’t seem to work.

submitted by /u/quarky_uk
[link] [comments]

Leave a Reply