Editing a ksh script > Please assist!


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Editing a ksh script > Please assist!
# 1  
Old 11-04-2008
Editing a ksh script > Please assist!

I am trying to edit a script that contains the following:

/DBA/general/sh/rman_backup.ksh -d PROD2 -l 1

I am trying to add a logic in the script such that if /DBA/general/sh/rman_backup.ksh does not exists, then the script would return an error code of 1. Otherwise, the script continues on.

Please assist.

Thanks!
# 2  
Old 11-04-2008
Use the -e option of test to check the existance of the file, something like:

Code:
if [ -e /DBA/general/sh/rman_backup.ksh ]; then
  /DBA/general/sh/rman_backup.ksh -d PROD2 -l 1
else
  return 1
fi

Read the manpage of test.

Regards
# 3  
Old 11-04-2008
I would test that the file exists and is executable i.e.
Code:
if [[ -x /DBA/general/sh/rman_backup.ksh ]]; then
    /DBA/general/sh/rman_backup.ksh -d PROD2 -l 1
else
    return 1
fi

# 4  
Old 11-04-2008
Quote:
Originally Posted by fpmurphy
I would test that the file exists and is executable i.e.
I agree with you on that. Smilie

Regards
# 5  
Old 11-04-2008
Thank You ... You have been great help.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Editing crontab via ksh

Hi all, I am trying the following I am hoping that the crontab would be changed. but it prints the previous crontab and says Can anyone tell me the correct ksh command that should be used here? I don't want to edit the crontab with crontab -e, I need to edit it via ksh. Thank... (2 Replies)
Discussion started by: ajaba
2 Replies

2. Shell Programming and Scripting

Need of a Parsing Script Assist...

Im trying to find a script that will pull ip addresses along with the date and time sort it by ip addresses and output it to a file... As a newbie to scripting im kinda stumped here...and suggestions? (2 Replies)
Discussion started by: jspinal
2 Replies

3. Shell Programming and Scripting

csv file editing using KSH

I'm trying to write a shell script to extract useful fields in a csv file and copy them to a new file: the input file is as below when opened using notepad++: //////////////////////////////////////////////////////////// ZZZZZZZZZZZZZZZZZZZZZZ ,"A", , , ,24,18,0,0,42,0 , ,B, ,... (1 Reply)
Discussion started by: zekruss
1 Replies

4. Shell Programming and Scripting

KSH script to run other ksh scripts and output it to a file and/or email

Hi I am new to this Scripting process and would like to know How can i write a ksh script that will call other ksh scripts and write the output to a file and/or email. For example ------- Script ABC ------- a.ksh b.ksh c.ksh I need to call all three scripts execute them and... (2 Replies)
Discussion started by: pacifican
2 Replies

5. UNIX for Dummies Questions & Answers

ksh command line editing text being overwritten

hi. i'm using ksh with set -o vi. if i am far down in a directory and try to edit the command line (esc-k to retrieve previous command) the cursor is being positioned over to the left on top of the directory text making the text very difficult to read or work with. seems to be problem with long... (2 Replies)
Discussion started by: jeffa123
2 Replies

6. Shell Programming and Scripting

New to KSH Scripting > Please Assist!

Array Example: $ colors=RED $ colors=GREEN $ colors=BLUE (4 Replies)
Discussion started by: ora_umair
4 Replies

7. Shell Programming and Scripting

import var and function from ksh script to another ksh script

Ih all, i have multiples ksh scripts for crontab's unix jobs they all have same variables declarations and some similar functions i would have a only single script file to declare my variables, like: var1= "aaa" var2= "bbb" var3= "ccc" ... function ab { ...} function bc { ... }... (2 Replies)
Discussion started by: wolfhurt
2 Replies

8. UNIX for Dummies Questions & Answers

Script Assist

Hello all I am new and I had a question that I was hoping you could answer. I am using mutt on a directory in this directory will be pdf files named 001.pdf , 002.pdf and so on. I need a script that can read the filename and associate that with a user like so : if 001.pdf exists then email... (16 Replies)
Discussion started by: linuxguy30350
16 Replies

9. Shell Programming and Scripting

Editing file during running ksh in HP failed

Hi falks, I have the following program: #!/bin/ksh ed -s /home/ias/v9.0.3/j2ee/OC4J_RiGHTv_HPCD2/applications/Xbip/Xbip/WEB -INF/config/application.properties <<EOF >/dev/null 1 d . d . a application.filePath.core = /core-HPCD2/Html/ application.filePath.xbip =... (2 Replies)
Discussion started by: nir_s
2 Replies

10. Shell Programming and Scripting

Editing a file using a script

Hi I have about 10 config files belonging to software that runs on SCO UNIX. These files contain, amongst many other things, a path which points to the software locations. We normally have to change them manually every time the software is coppied to a new location and when you gotta do a few... (45 Replies)
Discussion started by: Ypnos
45 Replies
Login or Register to Ask a Question