Hey all. I'm trying to write a small bash script and not having any luck getting it to work properly. I was hoping that someone here could take a look and tell me where I'm going wrong. The script is supposed to pull an archive file, replace all the dates in the file with today's date and tomorrow's date, spit out a new file, and then load it into Oracle. Here's what I've got:
Code:
#script tester.sh
#!/bin/bash
#Define variables
todaysDate=$(date +%Y%m%d)
tomorrowDate=$(date --date=tomorrow +%Y%m%d)
path=/home/scripts
cd $path
rm skedbase.txt
sed -e "s/20080729/$todaysDate/g" -e "s/20080730/tomorrowDate/g" skedbase.txt.old > skedbase.txt
su -l oracle -c "cd /oracle/scripts; ./runLoader.sh &"
exit 0
So I'm hitting two errors I don't understand. First :
Code:
cd: 7: can't cd to /home/scripts
It doesn't say why it can't change directories.
The second problem is that it performs the sed operation correctly, but it spits out a file named 'skedbase.txt?' instead of 'skedbase.txt'. I can't figure out why its doing that or how to fix it.
Suggestions?
Bookmarks