![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) | ||||||||||||||||||||||||||||||||||||||||||||||||
| Guest | using here strings for command input i just downloaded powershell as i'm trying to migrate a bash script to a Windows compatible scripting language.my script used to connect to an oracle database and used heredocuments ( here strings) for this goal as follows sqlplus -L user/passwd << EOF oracle sqlplus commands go here EOF trying the same thing with power shell sqlplus -L user/passwd @'
i'm wondering if there's analternative for '@' that would do the same job like for ex sqlplus -L user/passwd $'
| ||||||||||||||||||||||||||||||||||||||||||||||||
My System Specs![]() | |||||||||||||||||||||||||||||||||||||||||||||||||
| | #2 (permalink) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Guest | RE: using here strings for command input Steve, The problem your having is you've not created a here-string. instead of this
use this @' sqlplus -L user/passwd some commands '@ To signal to Powershell you are passing a here-string the @<qoute> must be on a line by itself likewise for the <quote>@ Having said that verify you can get the "stuff within the here-string to work correctly at the command line prior to putting it in one. "steve" wrote:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
My System Specs![]() | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| | #3 (permalink) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Guest | Re: using here strings for command input k guys , first let me thank you for the answers to start with Bob's answer, i tried your idea and it seems that power shell is just "swallowing" sqlplus coz i only get back the commands i typed between the @'.. '@. say @'
drop table test; create table test(test varchar2(100); exit; i checked the database and nothing is executed ! if your familiar with UNIX/Linux, you can have your program(not just sqlplus) grab the input ( the commands) from the shell using the syntax i showed you above - it's actually a kind of redirection '<<', your program will be reading those commands .thus when your shell script runs all that comes between @'..'@ is executed by the program not the shell. that's the behavior i'm seeking. and Shay, escaping the @ might clear things up for PS but not for sqlplus since @ has a special meaning for sqlplus, it instructs it that whatever follows '@' is an sql script relative-or-absolute path and it has to execute it so simply escaping '@' with something has no meaning for it. i assume this does not exist in windows just yet. "Shay Levi" wrote:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
My System Specs![]() | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| | #4 (permalink) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Guest | Re: using here strings for command input You can escape it with a backtick `@ get more info: help about_Escape_character --- Shay Levi $cript Fanatic http://scriptolog.blogspot.com
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
My System Specs![]() | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| | #5 (permalink) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Guest | Re: using here strings for command input "steve" <steve@xxxxxx> wrote in message news:8C2F5934-6438-4E5D-B9FC-EEACBB187A03@xxxxxx
7> echoargs -L user/passwd @'
Arg 1 is <user/passwd> Arg 2 is <some commands some more commands and some more commands> Note: echoargs is a utility in the PowerShell community extensions (http://www.codeplex.com/powershellcx). Could it be that the newlines in the here string are throwing off sqlplus? -- Keith | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
My System Specs![]() | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| | #6 (permalink) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Guest | Re: using here strings for command input Steve I've not see you directly answer whether you are able in powershell from the same directory able to execute the comands within the here-string. PowerShell unlike many shells does not let you execute commands that are not at least partially qualified. i.e.
dir variable:erroractionpreference Which version of PowerShell are you using? I've just "upgraded" my home machine to CPT2 so I can't or am not willing to go back to v1 yet. However I'm seeing so oddities here Can anyone who has CTPv2 answer the following question: What do you get back when you type dir c:\ what do you get back when you type @' dir c:\ '@ I'm not donig the happy dance. Howver I would have expected to see the contents of my C:\ drive: When I get into work on Monday I can check whether I'm doing something totally stupid or not. I don't use here-string regularily with the one exception of using Brians trick to commet out blocks of code so it may very will be I don't understand what a here-string is as well as I thought. "steve" wrote:
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||