Help required for these commands


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Help required for these commands
# 1  
Old 07-23-2008
Data Help required for these commands

Hi,

I was going through some environment scripts where I require to make some changes. There are a couple of commands I cant understand at all.

1:- SIDS=${*:-}

2:- for element in detail.func common1.func status.func stop_start.func mc.global log.func
under the for loop $element has been used.
detail.func, common1.func etc are some files that have been included at the start of the script and mostly contains a list of functions defined.
One of these scripts contain
"fn_status_NET8 () { fn_status_ALL ; }
fn_status_DB () { fn_status_ALL ; }
fn_status_GTWY () { fn_status_ALL ; }

fn_status_ALL () {
unset STATUS
fn_detail_${OBJECT} >/dev/null 2 >&1
mc_display "Env $ORACLE_SID - Service $OBJECT - Status $STATUS"
}"

which I cant understand either.

It would be a great help if anyone can explain me the three things.
Thanks a million in advance
# 2  
Old 07-23-2008
${variable:-default} returns the value of $variable, or if it's unset or empty, the text "default". So SIDS=${*:-} sets SIDS to the value of $*, or to "-" if it's unset.

for var in list of words; do ... done assigns to var each of the elements list, of, and words in turn, and executes the body of the loop. So in your example element is set to detail.func up until the corresponding done, then the same code is repeated with element set to common1.func, then status.func, then mc.global, then log.func. Judging from the names, these are file names containing function declarations, which are probably imported to be used by the script.

func () { body; } declares a function func whose contents are the commands in body so basically the fn_status_* functions are all declared as fn_status_ALL which in turn invokes fn_detail_$OBJECT and mc_display (it's not clear from the code you posted what $OBJECT is set to).
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help required in UNIX commands

I have 40000 records in a file where i need to change the 7th field date format from 05142016 to 20160514 I have given field below. any help would be highly appreciated. 364512|9999999|9999999|210553|195495477|195257095|05142016|10009|36313 ---------- Post updated at 05:02 AM... (2 Replies)
Discussion started by: arun888
2 Replies

2. AIX

HACMP: difference between 'cl' commands and 'cli' commands

Hi all, I'm new in this forum. I'm looking for the difference between the HACMP commands with the prefix "cl" and "cli". The first type are under /usr/es/sbin/cluster/sbin directory and the second are under /usr/es/sbin/cluster/cspoc directory. I know that the first are called HACMP for AIX... (0 Replies)
Discussion started by: peppix
0 Replies

3. UNIX for Dummies Questions & Answers

Help required in disabling commands.

I want to disable following commands in my linux distribution (Thanks to Linux hardening guide) # which rcp /usr/kerberos/bin/rcp # which rlogin /usr/kerberos/bin/rlogin # which rsh /usr/kerberos/bin/rsh When checked they were all part of krb5-workstation-1.6.1-25.el5 rpm. # rpm -qf... (2 Replies)
Discussion started by: pinga123
2 Replies

4. Solaris

Required list of all basic commands for a beginners

I want the commands list to view only files, and only directories and all the basic commands for a beginner of solaris (1 Reply)
Discussion started by: omsingh2k5
1 Replies

5. Shell Programming and Scripting

Getting required fields from a test file in required fromat in unix

My data is something like shown below. date1 date2 aaa bbbb ccccc date3 date4 dddd eeeeeee ffffffffff ggggg hh I want the output like this date1date2 aaa eeeeee I serached in the forum but didn't find the exact matching solution. Please help. (7 Replies)
Discussion started by: rdhanek
7 Replies

6. Solaris

Libraries required by commands

In solaris 10 how to I know what libraries are required by a particular command? please advise (1 Reply)
Discussion started by: Tirmazi
1 Replies

7. Shell Programming and Scripting

Can BASH execute commands on a remote server when the commands are embedded in shell

I want to log into a remote server transfer over a new config and then backup the existing config, replace with the new config. I am not sure if I can do this with BASH scripting. I have set up password less login by adding my public key to authorized_keys file, it works. I am a little... (1 Reply)
Discussion started by: bash_in_my_head
1 Replies

8. Shell Programming and Scripting

Help required to parse Oracle imp show=y output to DDL Commands

Hi, I generated an Oracle schema DDL script file using the show=y option of the Oracle import utility but the file that it generates needs a little more formating before we can run this as simple DDL comands to generate the schema at Target using the script file.Here is the simplified output of... (1 Reply)
Discussion started by: rajan_san
1 Replies

9. Linux

Help Required

Hi, please suggest me the possible reasons for application to get hang ???? Thanks and Regards Anand P (1 Reply)
Discussion started by: Anand Prakash
1 Replies

10. Programming

code that reads commands from the standard i/p and executes the commands

Hello all, i've written a small piece of code that will read commands from standard input and executes the commands. Its working fine and is execting the commands well. Accepting arguments too. e.g #mkdir <name of the directory> The problem is that its not letting me change the directory i.e... (4 Replies)
Discussion started by: Phrozen Smoke
4 Replies
Login or Register to Ask a Question