Sponsored Content
Top Forums Shell Programming and Scripting I wanted to update a script, more dynamic (just say no to hard coding)... Post 101941 by mr_manny on Tuesday 14th of March 2006 10:48:42 AM
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
 

8 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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

7. 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

8. 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
script(1)							   User Commands							 script(1)

NAME
script - make record of a terminal session SYNOPSIS
script [-a] [filename] DESCRIPTION
The script utility makes a record of everything printed on your screen. The record is written to filename. If no file name is given, the record is saved in the file typescript. See WARNINGS. The script command forks and creates a sub-shell, according to the value of $SHELL, and records the text from this session. The script ends when the forked shell exits or when Control-d is typed. OPTIONS
The following option is supported: -a Appends the session record to filename, rather than overwriting it. NOTES
script places everything that appears on the screen in filename, including prompts. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ |CSI |Enabled | +-----------------------------+-----------------------------+ SEE ALSO
attributes(5) WARNINGS
script can pose a security risk when used in directories that are writable by other users (for example, /tmp), especially when run by a privileged user, that is, root. Be sure that typescript is not a link before running script. SunOS 5.10 30 Jan 2004 script(1)
All times are GMT -4. The time now is 05:07 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy