Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email
?
1 Hour
1 Day
1 Week
1 Month
Forever
November 21, 2024, 05:21:07 PM
News
: LinuxSolved.com Linux Help Community Forum..
Home
Search
Login
Register
Linux Forums - Linux Help,Advice & support community:LinuxSolved.com
»
Others
»
Miscellaneous
»
bash shell programming with functions
« previous
next »
Print
Pages: [
1
]
Author
Topic: bash shell programming with functions (Read 6512 times)
universal
New Member
Posts: 2
bash shell programming with functions
«
on:
June 22, 2009, 03:16:07 PM »
I'm trying to write a function that will take a date in a certain format as an argument. (Say 2/13/87) Then using if then statements if the argument date is formatted correctly(2/13/87) note it can be any date, then the date will show formatted a different way (Say 1987-2-13) if no date is entered then I need it to return just the current date.
Logged
universal
New Member
Posts: 2
Re: bash shell programming with functions
«
Reply #1 on:
June 23, 2009, 09:25:11 PM »
This is a copy of what I have so far any help would be appreciated Thanks
function date2my()
{
date --date="$1" +"%m/%d/%y"
if [ "1" ]
then
echo "$1" +"%Y-%m-%d"
else
echo `date`
fi
}
Logged
Print
Pages: [
1
]
« previous
next »
Linux Forums - Linux Help,Advice & support community:LinuxSolved.com
»
Others
»
Miscellaneous
»
bash shell programming with functions