unix - How to store result from SQLPlus to a shell variable -
my requirement store result of sqlplus operation variable in shell script. need result of following operation in .sh file
sqlplus 'user/pwd' @test.sql i have tried
testvar = 'sqlplus 'user/pwd' @test.sql' but doesn't work.
edit::
i changed to
testvar=sqlplus foo/bar@schm @test.sql and says
sql*plus:: not found [no such file or directory]
i tried
testvar=$(sqlplus foo/bar@schm @test.sql) and gives same error. when try without variable assignment below
sqlplus foo/bar@schm @test.sql it works fine
employ backticks:
testvar=`sqlplus foo/bar @test.sql` or should of syntactical eyesore:
testvar=$(sqlplus foo/bar @test.sql) you know take right sql*plus commands limit superfluous output, yes? :) , of course beware backticking collapse whitespace of output.
Comments
Post a Comment