Results 1 to 4 of 4
Hi,
I'm just trying to make a simple date script that corresponds to different arguements...
The filename is dates.sh
#!/bin/bash
date +"%D"
date +"%d/%m/%y"
date +"%A, %B %d %Y"
date ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 10-24-2012 #1Just Joined!
- Join Date
- Oct 2012
- Posts
- 5
Need help with simple bash script
Hi,
I'm just trying to make a simple date script that corresponds to different arguements...
The filename is dates.sh
#!/bin/bash
date +"%D"
date +"%d/%m/%y"
date +"%A, %B %d %Y"
date +"%s"
I just want to be able to have the arguement "one" to correspond to the first date format (date +"%D"). So that when I type ./dates.sh one, only the first date format is displayed and so on.
I would appreciate it if someone could help me out.
Thanks!
- 10-24-2012 #2Trusted Penguin
- Join Date
- May 2011
- Posts
- 3,680
- 10-24-2012 #3Just Joined!
- Join Date
- Oct 2012
- Posts
- 5
thanks a lot, worked like a charm. first attempt at this and that definitely helped.
sorry about the double post, i didn't see this category initially.
- 10-24-2012 #4Trusted Penguin
- Join Date
- May 2011
- Posts
- 3,680
Glad you got it sorted. Be sure to check out the Bash man page in the future. You can read about the case statement and positional parameters ($1, $2, etc.) and other useful things:
Code:man bash
Hey, no worries! Enjoy your stay here.sorry about the double post, i didn't see this category initially.


Reply With Quote

