Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Using Here-Doc with Powershell

390 views
Skip to first unread message

jgndml

unread,
Apr 22, 2010, 8:25:27 AM4/22/10
to
Hi folks,
got a question regarding here-docs (also known as here-scripts, here-is etc) with Powershell. Maybe anybody out there has a tip...

On a UNIX shell (Bash), the following script works (meaning that the 'help' command is executed and then the program quits):

$ sqlplus /NOLOG <<EOF
help
exit
EOF

Note: sqlplus is a utility shipped with the Oracle Database binaries, but I don't care that tool. My question is about how to construct here-scripts!

My equivalent code for Powershell is:

PS> sqlplus /NOLOG @'
help
exit
'@

Unfortunately, it does not work.
Any suggestions?

Regards
jgn


Submitted via EggHeadCafe - Software Developer Portal of Choice
Get Silverlight 4 Installed: Tips and Tricks
http://www.eggheadcafe.com/tutorials/aspnet/05910e41-3846-4db9-8e1b-f54c56a64ed9/get-silverlight-4-install.aspx

Larry__Weiss

unread,
Apr 22, 2010, 10:39:44 AM4/22/10
to
Consider this example of a here-string piped to Tee-Object

PS> @'
one
two
'@ | Tee-Object tee.out

So, try

PS> @'
help
exit
'@ | sqlplus /NOLOG

- Larry

jgndml

unread,
Apr 23, 2010, 7:37:09 AM4/23/10
to
Great tip - it works! Thank you so much...

Cheers
jgn

Larry__Weiss wrote:

Consider this example of a here-string piped to Tee-ObjectPS> @'onetwo'@ |

22-Apr-10

Consider this example of a here-string piped to Tee-Object

PS> @'
one
two
'@ | Tee-Object tee.out

So, try

PS> @'
help
exit
'@ | sqlplus /NOLOG

- Larry


On 4/22/2010 7:25 AM, jgn dml wrote:

Previous Posts In This Thread:


Submitted via EggHeadCafe - Software Developer Portal of Choice

Using VSTO Add-In To Automate Frequent Excel 2007 Tasks
http://www.eggheadcafe.com/tutorials/aspnet/ff2d1d4b-aedf-4d14-9e60-39a86ccab5d6/using-vsto-addin-to-auto.aspx

0 new messages