LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-27-2007, 01:45 PM   #1
DjRakso
LQ Newbie
 
Registered: Nov 2006
Posts: 12

Rep: Reputation: 0
Help, with subshell I think? :S


Hi,
I am trying to create a shell script that will ask the user for the "oracle" username and password for the database then execute a sql command exit and return back to the root user and do other commands.
I was thinking of something like a subshell script but I dont know how to go about it.
My method on going at it would be
1) As "root", ask for user/pass (oracle database user/pass)
2) Then log automatically as "oracle" (linux user) and run command "sqlplus"
3) When the sqlplus prompt comes up for username it grabs the input from before and puts it into that line and does so with the password afterwards.
4) Runs sql commands then exits out of oracle database.
5) exits out of "oracle" (linux user) and goes back to root and performs any other commands I want it to.

Hopefully, this is enough information. If you need more I am happy to tell you what I exactly need.
Thanks for reading my thread.

~DjRakso
 
Old 10-28-2007, 08:09 AM   #2
spirit receiver
Member
 
Registered: May 2006
Location: Frankfurt, Germany
Distribution: SUSE 10.2
Posts: 424

Rep: Reputation: 33
Seems like you want to write an expect script. Have a look at the following for some information: http://www.linuxjournal.com/article/3065.
 
Old 10-28-2007, 12:31 PM   #3
Jim44
Member
 
Registered: Feb 2006
Location: Atlanta, Georgia, USA
Distribution: Mint, Ubuntu, Centos
Posts: 52

Rep: Reputation: 15
Quote:
Originally Posted by DjRakso View Post
Hi,
I am trying to create a shell script that will ask the user for the "oracle" username and password for the database then execute a sql command exit and return back to the root user and do other commands.
I was thinking of something like a subshell script but I dont know how to go about it.
My method on going at it would be
1) As "root", ask for user/pass (oracle database user/pass)
2) Then log automatically as "oracle" (linux user) and run command "sqlplus"
3) When the sqlplus prompt comes up for username it grabs the input from before and puts it into that line and does so with the password afterwards.
4) Runs sql commands then exits out of oracle database.
5) exits out of "oracle" (linux user) and goes back to root and performs any other commands I want it to.

Hopefully, this is enough information. If you need more I am happy to tell you what I exactly need.
Thanks for reading my thread.

~DjRakso
http://linuxhelp.blogspot.com/2005/1...ash-shell.html

Search down for the "read" command. This article should help you with 1.

The expect command mentioned previously may satisfy the rest of the requirements.

Jim.
 
Old 10-28-2007, 04:24 PM   #4
DjRakso
LQ Newbie
 
Registered: Nov 2006
Posts: 12

Original Poster
Rep: Reputation: 0
Thx spirit receiver & Jim44 for your advice.
I will keep that in mind.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
tcsh How to execute foreach in subshell? kaz2100 Programming 1 07-07-2007 08:10 AM
mc subshell.c: read (subshell_pty...): rickenbacherus Linux - Software 2 07-14-2004 08:14 PM
Continuing a script on a new subshell dpillay Programming 2 05-29-2004 08:26 PM


All times are GMT -5. The time now is 07:01 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration