Sponsored Content
Top Forums Shell Programming and Scripting Need help with simple script (noob) Post 302720341 by earthicle on Tuesday 23rd of October 2012 08:02:14 PM
Old 10-23-2012
Need help with simple script (noob)

Hi

This is my first time attempting a bash script, or any kind of programming.

I'm trying to get a clear picture but it helps to work backwards.

It would be greatly appreciated if someone could show me what this script would look like...

Write a script that displays todays date in MM/DD/YY format (2/20/07), in DD/MM/YY (20/Feb/07) format (European style), as a "long" format - Tuesday, February 20 2007 - and as a Unix time stamp (*nix keeps track of time as being the number of elapsed seconds since midnight January 1 1970).

Thanks Smilie
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Using PHP script with crontab (NOOB)

Hi, I am trying to use a PHP script as a test for a cron job. My crontab is 1 line: 30 * * * * /home/www/inc/crontab.php if I test the file through the browser (ie. http://www.domain.com/inc/crontab.php), the PHP script works -- so there is nothing wrong with the PHP script itself or the... (5 Replies)
Discussion started by: Bobafart
5 Replies

2. Shell Programming and Scripting

noob. need help to create a script.

Hi All. im a noob to scripting. could somone help me with a script please. what i want to do is. 1. run a cmd in the script - qmqtool -s this will give me an output similar to this. Messages in local queue: 790 Messages in remote queue: 306 Messages in todo queue: 23 i then want... (1 Reply)
Discussion started by: aron
1 Replies

3. Shell Programming and Scripting

Why does my script not work? (Noob Alert)

I am a scripting noob and I have tried to search on google, but cannot find the answer as to why this script doesn't work properly. The idea of this script is that it will list all files starting with f in a certain folder, and delete all but the three newest one. I am trying to achieve this by... (4 Replies)
Discussion started by: bronkeydain
4 Replies

4. Shell Programming and Scripting

Noob needs script help Grep

while read s1 s2; do grep -i -w $s1 6-29data | tr "" "" | sed 's/^*,//' | sed 's/200906/2009-06-/g' >> $s1.txt ; cat header > here ; cat $s1.txt | sort | uniq | tac >> here ; cat here | uniq > $s1.txt ; done < list Wow this almost worked file list has 8000 stock symbols which are... (4 Replies)
Discussion started by: harte
4 Replies

5. Ubuntu

Simple Noob Question

I am editing the squid.confi on my server. I am done editing. How do I exit the confi file? Thank you. (2 Replies)
Discussion started by: sethartha
2 Replies

6. UNIX for Dummies Questions & Answers

Linux noob needing help with a script

Hi, Very new to linux but I've just recently setup an ubuntu server. I have 2 broadband connections and would like to have fallback on the server should one of the lines fail. I know what I want it to do, but dont know how to script it. heres the senario; ubuntu server with 2 ethernet... (0 Replies)
Discussion started by: ziggycat
0 Replies

7. Shell Programming and Scripting

Total noob script

Hi i am a total noob at shell scripting. i was wondering if somebody could help me with my script. i want the script to search the dev folder for the burner file because they are different between distrubutions? as i under stand it. this i the script. #!/bin/bash echo "Script för att bränna 360... (4 Replies)
Discussion started by: MatsO
4 Replies

8. UNIX for Dummies Questions & Answers

Is there any way of splitting the script (Noob Here).

I m writing a script to check Server Hardening. The problem is whenever i add new point it grows and it become very tedious to edit the script file. Is there any way of making them separate and call them from one base script? Is it possible to define global variable that can be accessed via... (5 Replies)
Discussion started by: pinga123
5 Replies

9. UNIX for Dummies Questions & Answers

Date check script (noob)

Hello, I've been given the task of checking the date of expiration dates and notify when the date is 30 days away from expiration. As stated in the Title, I'm very new to this, I did a good bit of work over the last two days to only find out I was going down the wrong path. I'm not... (3 Replies)
Discussion started by: drey4184
3 Replies

10. UNIX for Beginners Questions & Answers

Noob. shell script with prompt?

Hey Guys and Gals, Im a complete Noob to Unix. But recently have started working on a unix system for my PET/CT scanner. My scanner comes with a MOD drive for backup. I would like to back up to USB (its alot cheaper). But the only way to do so is by manually enterin the unix commands. Id like to... (13 Replies)
Discussion started by: TorresGXL
13 Replies
IDATE(3)								 1								  IDATE(3)

idate - Format a local time/date as integer

SYNOPSIS
int idate (string $format, [int $timestamp = time()]) DESCRIPTION
Returns a number formatted according to the given format string using the given integer $timestamp or the current local time if no time- stamp is given. In other words, $timestamp is optional and defaults to the value of time(3). Unlike the function date(3), idate(3) accepts just one char in the $format parameter. PARAMETERS
o $format - The following characters are recognized in the $format parameter string +------------------+---------------------------------------------------+ |$format character | | | | | | | Description | | | | +------------------+---------------------------------------------------+ | | | | B | | | | | | | Swatch Beat/Internet Time | | | | | | | | d | | | | | | | Day of the month | | | | | | | | h | | | | | | | Hour (12 hour format) | | | | | | | | H | | | | | | | Hour (24 hour format) | | | | | | | | i | | | | | | | Minutes | | | | | | | | I (uppercase i) | | | | | | | returns 1 if DST is activated, 0 otherwise | | | | | | | | L (uppercase l) | | | | | | | returns 1 for leap year, 0 otherwise | | | | | | | | m | | | | | | | Month number | | | | | | | | s | | | | | | | Seconds | | | | | | | | t | | | | | | | Days in current month | | | | | | | | U | | | | | | | Seconds since the Unix Epoch - January 1 1970 | | | 00:00:00 UTC - this is the same as time(3) | | | | | | | | w | | | | | | | Day of the week ( 0 on Sunday) | | | | | | | | W | | | | | | | ISO-8601 week number of year, weeks starting on | | | Monday | | | | | | | | y | | | | | | | Year (1 or 2 digits - check note below) | | | | | | | | Y | | | | | | | Year (4 digits) | | | | | | | | z | | | | | | | Day of the year | | | | | | | | Z | | | | | | | Timezone offset in seconds | | | | +------------------+---------------------------------------------------+ o $timestamp - The optional $timestamp parameter is an integer Unix timestamp that defaults to the current local time if a $timestamp is not given. In other words, it defaults to the value of time(3). RETURN VALUES
Returns an integer. As idate(3) always returns an integer and as they can't start with a "0", idate(3) may return fewer digits than you would expect. See the example below. ERRORS
/EXCEPTIONS Every call to a date/time function will generate a E_NOTICE if the time zone is not valid, and/or a E_STRICT or E_WARNING message if using the system settings or the $TZ environment variable. See also date_default_timezone_set(3) CHANGELOG
+--------+---------------------------------------------------+ |Version | | | | | | | Description | | | | +--------+---------------------------------------------------+ | 5.1.0 | | | | | | | Now issues the E_STRICT and E_NOTICE time zone | | | errors. | | | | +--------+---------------------------------------------------+ EXAMPLES
Example #1 idate(3) example <?php $timestamp = strtotime('1st January 2004'); //1072915200 // this prints the year in a two digit format // however, as this would start with a "0", it // only prints "4" echo idate('y', $timestamp); ?> SEE ALSO
date(3), getdate(3), time(3). PHP Documentation Group IDATE(3)
All times are GMT -4. The time now is 11:44 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy