Basic Shell Scripting


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Basic Shell Scripting
# 1  
Old 09-18-2014
Basic Shell Scripting

Hi All,

I am a newbie to shell scripting. I am trying to something like this.
Code:
#!bin/bash
cd /u01/app/oracle/

# then start the process
./opmnctl startall

Can someone help me with this requirement.

Help is very much appreciated.

Thanks
Venkat

Moderator's Comments:
Mod Comment Please use code tags next time for your code and data. Thanks
# 2  
Old 09-18-2014
try
Code:
#!bin/bash

# start the process from absolute path
. /u01/app/oracle/opmnctl startall

# 3  
Old 09-18-2014
The shebang needs an absolute file path:
Code:
#!/bin/bash

Does /u01/app/oracle/opmnctl exist? What does
Code:
ls -l /u01/app/oracle/opmnctl

produce?


--
@makarand Dodmis: that would be sourcing

Last edited by Scrutinizer; 09-18-2014 at 12:31 PM..
# 4  
Old 09-18-2014
Hello venkat8439,

Welcome to the forum. It's a request please use the code tage while posting the codes and commands as per forum rules. Now for your script yes you are going good. You need to put the same commands in a file which should have execution permission(or depending on your need like if you allow others to execute or not) and then try to execute it. Also keep shebang on top of the script.


Thanks,
R. Singh
This User Gave Thanks to RavinderSingh13 For This Post:
# 5  
Old 09-18-2014
Hi All,

Code:
#!/bin/bash
. /u01/app/oracle/obiee117g/instances/instance1/bin/opmnctl status

I am getting this output

Code:
[oracle@xxxxxx obiee_scripts]$ ./start_opmnctl1.sh
/u01/app/oracle/obiee117g/instances/instance1/bin/opmnctl: line 25: =: command not found
/u01/app/oracle/obiee117g/instances/instance1/bin/opmnctl: line 26: =: command not found
/u01/app/oracle/obiee117g/instances/instance1/bin/opmnctl: line 28: syntax error near unexpected token `('


Last edited by vbe; 09-18-2014 at 12:45 PM.. Reason: extra code tags
# 6  
Old 09-18-2014
Update your PATH variable at the beginning of your script by adding /u01/app/oracle/obiee117g/instances/instance1/bin to it and try again...
e.g.
Code:
export PATH=$PATH:$HOME/bin:/u01/app/oracle/obiee117g/instances/instance1/bin


Last edited by vbe; 09-18-2014 at 01:01 PM.. Reason: added e.g.
# 7  
Old 09-18-2014
Code:
#!/bin/bash
export PATH=$PATH:/u01/app/oracle/obiee117g/instances/instance1/bin
. /u01/app/oracle/obiee117g/instances/instance1/bin/opmnctl status

Is this right ??

If so.. I am getting following message

Code:
/u01/app/oracle/obiee117g/instances/instance1/bin/opmnctl: line 25: =: command not found
/u01/app/oracle/obiee117g/instances/instance1/bin/opmnctl: line 26: =: command not found
/u01/app/oracle/obiee117g/instances/instance1/bin/opmnctl: line 28: syntax error near unexpected token `('
/u01/app/oracle/obiee117g/instances/instance1/bin/opmnctl: line 28: `%commands = ('

Thanks
Venkat
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

which is the Very basic certification on unix shell scripting?

Hi, I am very new to this forum, can any one tell me which is the very basic certification on unix shell scripting? please give me an advice on this. (1 Reply)
Discussion started by: Manjesh
1 Replies

2. UNIX for Dummies Questions & Answers

Help with basic scripting!

Hey I have to create a unix script that when run uses the 'man' command to print out the command information of commands passed as arguments. I have the basic pseudo code, but I don't know how to implement a loop. Any help is greatly appreciated. Cheers. short-manual <ls cc pwd>... (3 Replies)
Discussion started by: sarovarc
3 Replies

3. Shell Programming and Scripting

Call Shell scripting from Perl Scripting.

Hi How to call a shell scripting through a Perl scripting? Actually I need some value from Shell scripting and passes in the Perl scripting. So how can i do this? (2 Replies)
Discussion started by: anupdas
2 Replies

4. Shell Programming and Scripting

basic scripting syntax

In bash scripts please can someone tell me if the below is the correct syntax for comparing integers and strings; for integers - if ;then for strings - if ; then Thanks Calypso (4 Replies)
Discussion started by: Calypso
4 Replies

5. UNIX for Dummies Questions & Answers

basic scripting help

I would like to know: 1. How is `command` used? 2. How is '$command' used? For example, a script file that checks for apache tomcat processes that I created has the following lines: test set suffix=` grep "6.0.18"` set command = `ps -ef $suffix` echo $command //?? hoping this... (2 Replies)
Discussion started by: jon80
2 Replies

6. Shell Programming and Scripting

basic shell scripting question

If I did indeed grep something out of it, why woudln't $result show nothing? When I do $? , it does show success... What is the proper syntax so that $result shows actual thing it's grepping out? result=`(ssh $host tail -1 /something/somethingelse) | egrep -i "value" >dev/null` #echo... (3 Replies)
Discussion started by: convenientstore
3 Replies

7. Shell Programming and Scripting

Shell scripting basic doubt

Hi, I have a script called sam.sh which consists of a single echo statement like this #/usr/bin/ksh echo "Mani" I changed the mode for the script by giving chmod a+x sam.sh. If I want to execute the scrpt by just giving the name at the command line "sam.sh", what should I necessarily do?... (3 Replies)
Discussion started by: sendhilmani123
3 Replies

8. Shell Programming and Scripting

difference between AIX shell scripting and Unix shell scripting.

please give the difference between AIX shell scripting and Unix shell scripting. (2 Replies)
Discussion started by: haroonec
2 Replies

9. Shell Programming and Scripting

What is a good place to learn basic shell scripting? Thanks!

See the title. Originally wasn't going to type anything but I need a message of at least 10 characters! :cool: (2 Replies)
Discussion started by: deutchap6verse5
2 Replies
Login or Register to Ask a Question