I have a situation where I am writing a shell script that will accept a date value it will then pass this date value to an Oracle stored procedure for processing.
I want to format the date into (01-SEP-08) before passing to the proc. I also want to make sure the value passed in is a date value if its not then i need to display an error message i.e. Invalid Date.
I am new to this language and in language's like Java etc this would be a 1 liner just call a function pass in the date along with the format you want.
Is this achievable with a Shell Script?
Here is my code...
#!/bin/ksh
DATE=$1
if [ -z "$DATE" ] #I first check for null and format sysdate which is no problem
then
DATE=`date '+%d-%b-%y`
echo $DATE
else
#This is where I want to format the arg variable how can I do that?
echo $DATE
fi
Please help...