I wanted to update a script, more dynamic (just say no to hard coding)...


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting I wanted to update a script, more dynamic (just say no to hard coding)...
# 1  
Old 03-14-2006
I wanted to update a script, more dynamic (just say no to hard coding)...

currently it has the following:
bdumpN=`ll /home/apps/oracle/admin/DBprod/bdump/DBprod_j* | grep "$Cdate" | wc -l`

If I pass the DBname, I would not have to hardcode it in the script...
I can capture the database name by adding the following:
DBname=$1

The problem is, I have been unable to get the listing to work properly (the following do not work):
bdumpN=`ll /home/apps/oracle/admin/$DBname/bdump/$DBname_j* | wc -l`
and tried
bdumpN=`ll /home/apps/oracle/admin/$DBname/bdump/$DBname"_j*" | wc -l`

Both do not return the correct DBprod_j* files...

If I run the command in-line, I get the following:
# ll /home/apps/oracle/admin/DBprod/bdump/DBprod_j* | wc -l
8

here is a list of files:
-rw-r--r-- 1 oracle dba 24716 Mar 4 06:01 /home/apps/oracle/admin/DBprod/bdump/DBprod_j000_10115.trc
-rw-r--r-- 1 oracle dba 24917 Mar 8 06:01 /home/apps/oracle/admin/DBprod/bdump/DBprod_j000_13643.trc
-rw-r--r-- 1 oracle dba 25099 Mar 9 06:01 /home/apps/oracle/admin/DBprod/bdump/DBprod_j000_14782.trc
-rw-r--r-- 1 oracle dba 25237 Mar 11 06:01 /home/apps/oracle/admin/DBprod/bdump/DBprod_j000_16386.trc
-rw-r--r-- 1 oracle dba 1090 Mar 9 18:34 /home/apps/oracle/admin/DBprod/bdump/DBprod_j000_21193.trc
-rw-r--r-- 1 oracle dba 25196 Mar 10 07:46 /home/apps/oracle/admin/DBprod/bdump/DBprod_j000_29055.trc
-rw-r--r-- 1 oracle dba 24915 Mar 7 08:25 /home/apps/oracle/admin/DBprod/bdump/DBprod_j000_29819.trc
-rw-r--r-- 1 oracle dba 23426 Mar 6 00:00 /home/apps/oracle/admin/DBprod/bdump/DBprod_j001_10244.trc

thanks,
manny
# 2  
Old 03-14-2006
Try:
bdumpN=`ll /home/apps/oracle/admin/$DBname/bdump/${DBname}_j* | wc -l`
# 3  
Old 03-14-2006
Perderabo, I owe you...it worked Smilie
thanks,
manny
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Web Development

Using LWP without hard coding password

Hi, I would like to read content from a https site. I have decided to use LWP module in perl. but it throwed 401 Authorization required error. i dont want to hard code the password in my perl code. Is there any way to achieve the authentication without hardcoding the password. Thanks,... (1 Reply)
Discussion started by: pandeesh
1 Replies

2. Shell Programming and Scripting

Script to detect dynamic ip change and update to config file

Hi All, I am newbie here and request your assistance. I have a service running on public ip, but since I have a dynamic IP it keeps on changing and every time I need to manually get the new ip and add to the config file and restart the service. This has become bit time consuming. Hence, I... (4 Replies)
Discussion started by: Shaan_Shaan
4 Replies

3. Shell Programming and Scripting

I just wanted to share this bash script for linux

If your Unix box doesn't support bash scripts then do not do the following. Create a file named version. type chmod 755 version and then copy and paste the code below into the file. Then type "mv version /bin" and presto, type version. A cool full hearty command. If you know more about you're Os... (3 Replies)
Discussion started by: Errigour
3 Replies

4. Shell Programming and Scripting

help wanted to understand MQ script

hi , i am writing a script to copy the MQ messages from onw queue to another. The following i got from one site, but i di not understand , can anyone explain. /root/scripts/sap/q -m$Q_MANAGER -i$Q_NAME_SRC_1 -F/logs/mq/MQ_COPYdump_$Q_NAME_SRC_1.$$ /root/scripts/sap/q -m$Q_MANAGER... (0 Replies)
Discussion started by: Satyak
0 Replies

5. Programming

char constants vs. hard-coding

This might be a silly question, but I thought I'd ask anyway. If I'm writing in C, isn't it more efficient to, for instance, use constant character variable set to 'A' instead of hard-coding a character 'A'? Since it's only a single character instead of a string, it might not matter much. (10 Replies)
Discussion started by: cleopard
10 Replies

6. UNIX for Dummies Questions & Answers

Sending mails to various users without hard coding the email IDS

Hi Can any one help me out ? I am trying to send an autogenerated mail with an attachment to bulk of users using 'MAILX' and 'UNENCODE' . I have used it as follows X " ( cat /sastemp/body.txt; uuencode Test.xls.gz Test.xls.gz ) | mailx -s 'Testing' ' abcd@yahoo.com , efgh@gmail.com ' " ... (9 Replies)
Discussion started by: manas6
9 Replies

7. Shell Programming and Scripting

Dynamic update loop query on Sybase database

Hello Guys, I'm new to Shell scripting, and i need someone to help me with this issue: I'm trying to do a dynamic update query on Sysbase database table using shell script. Lets say, the Update query is "update Table set id=X" , where X is dynamic value for the loop index. If the loop is... (10 Replies)
Discussion started by: Alaeddin
10 Replies

8. UNIX for Advanced & Expert Users

dynamic update of docs

hi, i have some files which r link to the directory and to refer these files there is a html link on my web page At the moment there are only 2 active links. I created a soft link to the original source at very first time, the owner of these documents can change the content and update... (1 Reply)
Discussion started by: sushil_d10
1 Replies
Login or Register to Ask a Question