Home » Infrastructure » Unix » Error in creating folders using shell script
Error in creating folders using shell script [message #265255] Wed, 05 September 2007 22:44 Go to next message
navaneethdba
Messages: 71
Registered: July 2007
Location: chennai
Member
hi,

I need to create a folder in the name of current date at run time. And take RMAN backup in that folder. i tried this

Echo off
NowDate=`Date '+%d'`
Backup_home=/backup_lv
Cur_Day_Dir=$Backup_home/$NowDate

if not exist $Cur_Day_Dir mkdir $cur_day_dir

cd $Backup_home
del backup_cmd.txt
echo 2>backup_cmd.txt

set cmdfile=$Backup_home\backup_cmd.txt
echo run >>backup_cmd.txt
echo { >>backup_cmd.txt
echo allocate channel c1 device type disk format='$Cur_Day_Dir%/db_%%u_%%p_%%s'; >>backup_cmd.txt
echo backup incremental level 1 database plus archivelog not backed up delete input; >>backup_cmd.txt
echo } >>backup_cmd.txt

but it gives some error. i am new to unix.

can u help me to do this? i searched in google i couldnt find the solution plz help....
Re: Error in creating folders using shell script [message #265259 is a reply to message #265255] Wed, 05 September 2007 22:52 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
>but it gives some error
Error? what error?
I don't see any error; therefore I have nothing to fix.

Please read & follow posting Guidelines as stated in the STICKY post at top of this forum.
Re: Error in creating folders using shell script [message #265264 is a reply to message #265259] Wed, 05 September 2007 23:02 Go to previous messageGo to next message
navaneethdba
Messages: 71
Registered: July 2007
Location: chennai
Member
Thanks for ur reply...
I tried this

$ cat test.sh
Eco off
NowDate="Incr_sep`Date '+%d'`"
Backup_home=/backup_lv
Cur_Day_Dir=$Backup_home/$NowDate

if not exist $Cur_Day_Dir mkdir $cur_day_dir



it shows the error like

$ test.sh
test.sh: Eco: not found.
test.sh[2]: Date: not found.
test.sh[6]: 0403-057 Syntax error at line 6 : `if' is not matched

TIA,
Re: Error in creating folders using shell script [message #265265 is a reply to message #265264] Wed, 05 September 2007 23:07 Go to previous messageGo to next message
navaneethdba
Messages: 71
Registered: July 2007
Location: chennai
Member
Am sorry some mistake there
see this

$ cat test.sh
echo off
NowDate="Incr_sep`Date '+%d'`"
Backup_home=/backup_lv
Cur_Day_Dir=$Backup_home/$NowDate

if not exist $Cur_Day_Dir mkdir $cur_day_dir


it shows error like below

$ test.sh
off
test.sh[2]: Date: not found.
test.sh[6]: 0403-057 Syntax error at line 6 : `if' is not matched.

TIA,
Re: Error in creating folders using shell script [message #265266 is a reply to message #265255] Wed, 05 September 2007 23:12 Go to previous message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
>$ test.sh
>test.sh: Eco: not found.

Eco is NOT a valid unix command

>test.sh[2]: Date: not found.

Date is NOT a valid unix command

>if not exist $Cur_Day_Dir mkdir $cur_day_dir
above not valid "if" syntax

NONE of this has anything to do with Oracle itself.
Please post in non-Oracle or generic Unix forum.

It appears you have little or no experience with Oracle or Unix.
I suggest you concentrate on Access & GUIs where all you need to do is point & click.
Previous Topic: need help
Next Topic: how to use crontab
Goto Forum:
  


Current Time: Thu Mar 28 12:23:49 CDT 2024