12-03-2014
Do not post classroom or homework problems in the main forums. Homework and coursework questions can only be posted in
this forum under
special homework rules.
Please review the
rules, which you agreed to when you registered, if you have not already done so.
More-than-likely, posting homework in the main forums has resulting in a forum infraction. If you did not post homework, please explain the company you work for and the nature of the problem you are working on.
If you did post homework in the main forums, please review the
guidelines for posting homework and repost.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi guys!
I have just started with shell programming!!
I am having pronblem with variable subsitutuion.
when i do
egrep "*" marks
this will give me the pattern match.
but how can i catch the output of that result in a variable.
if i say
result = egrep "*" marks
it gives me syntax... (2 Replies)
Discussion started by: vmtailor
2 Replies
2. UNIX for Dummies Questions & Answers
Hi Guys,
I am trying to alter a script for my company.
I need the start of it to go something like this.
User is asked to input 8 numbers
8 numbers are written to a txt file
***** ***** ***** txt file is read ***** *****
The text file gets read in between other files represented by... (2 Replies)
Discussion started by: outthere_3
2 Replies
3. Shell Programming and Scripting
Hi all,
i am beginner to unix and trying out a shell script which does the following. i have to calculate a persons salary. his salary is read from the keyboard. he has two types of deductions. 40% as dearness allowance and 20% as house rent. i have to print the gross salary. here is the code... (5 Replies)
Discussion started by: Irishboy24
5 Replies
4. Shell Programming and Scripting
I need to invoke a program on remote server using ssh in a shell script. In addition i would like to capture date/time and if there is any errors , then script should write to log file. can someone please help me out? (1 Reply)
Discussion started by: sam101
1 Replies
5. Shell Programming and Scripting
Hi,
I have a file in which records contains non ascii characters. The records are comma delimited and quoted.
The non ascii characters are found in a particular column.
Example records
"YY","AK000021","Ã","IO","PP"
"Y1","AK000022","Ã","PO","PP"
"Y2","AK000022","Ã","PO","PP"
I need to... (2 Replies)
Discussion started by: akshu.agni
2 Replies
6. Shell Programming and Scripting
HELP!My program ends after entering one choice---need help making it take multiple inputs,instead of terminating after displaying just one
#!/bin/bash# Crude address databaseclear # Clear the screen.echo " Contact List"echo " ------- ----"echo "Choose one of the following... (6 Replies)
Discussion started by: help123
6 Replies
7. Shell Programming and Scripting
hi guys
we've had nagios spewing false alarm (for the umpteenth time) and finally the customer had enough so they're starting to question nagios. we had the check interval increased from 5 minutes to 2 minutes, but that's just temporary solution. I'm thinking of implementing a script on the... (8 Replies)
Discussion started by: hedkandi
8 Replies
8. Shell Programming and Scripting
Hi All,
I have a script which as below
#!/bin/bash
for i in `cat servers`
do
ssh uname@$i "df -t xfs --total | grep total";
done > out.txtOutput as below
--------------
total 140583991104 118622795524 21961195580 85% -
total 140583991104 112888595524 27695395580 ... (4 Replies)
Discussion started by: npk
4 Replies
9. Shell Programming and Scripting
So I'm trying to pass certain json elements as env vars and use them later on in a script.
Sample json:
JSON='{
"Element1": "file-123456",
"Element2": "Name, of, company written in, a very weird way",
"Element3": "path/to/some/file.txt",
}'
(part of the) script:
for s... (5 Replies)
Discussion started by: da1
5 Replies
10. UNIX for Beginners Questions & Answers
In Bash shell - the ps -ef shows only the /bin/bash but the script name is not displayed ? Is there any way to get the script names for the process command ?
--- Post updated at 08:39 AM ---
in KSH (Korn Shell), my command output shows the script names but when run in the Bash Shell... (3 Replies)
Discussion started by: i4ismail
3 Replies
GETDATE(3) 1 GETDATE(3)
getdate - Get date/time information
SYNOPSIS
array getdate ([int $timestamp = time()])
DESCRIPTION
Returns an associative array containing the date information of the $timestamp, or the current local time if no $timestamp is given.
PARAMETERS
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 associative array of information related to the $timestamp. Elements from the returned associative array are as follows:
Key elements of the returned associative array
+----------+--------------------------------------+---+
| Key | | |
| | | |
| | Description | |
| | | |
| | Example returned values | |
| | | |
+----------+--------------------------------------+---+
| | | |
|"seconds" | | |
| | | |
| | Numeric representation of seconds | |
| | | |
| | | |
| | 0 to 59 | |
| | | |
| | | |
|"minutes" | | |
| | | |
| | Numeric representation of minutes | |
| | | |
| | | |
| | 0 to 59 | |
| | | |
| | | |
| "hours" | | |
| | | |
| | Numeric representation of hours | |
| | | |
| | | |
| | 0 to 23 | |
| | | |
| | | |
| "mday" | | |
| | | |
| | Numeric representation of the day of | |
| | the month | |
| | | |
| | | |
| | 1 to 31 | |
| | | |
| | | |
| "wday" | | |
| | | |
| | Numeric representation of the day of | |
| | the week | |
| | | |
| | | |
| | 0 (for Sunday) through 6 (for Satur- | |
| | day) | |
| | | |
| | | |
| "mon" | | |
| | | |
| | Numeric representation of a month | |
| | | |
| | | |
| | 1 through 12 | |
| | | |
| | | |
| "year" | | |
| | | |
| | A full numeric representation of a | |
| | year, 4 digits | |
| | | |
| | Examples: 1999 or 2003 | |
| | | |
| | | |
| "yday" | | |
| | | |
| | Numeric representation of the day of | |
| | the year | |
| | | |
| | | |
| | 0 through 365 | |
| | | |
| | | |
|"weekday" | | |
| | | |
| | A full textual representation of the | |
| | day of the week | |
| | | |
| | | |
| | Sunday through Saturday | |
| | | |
| | | |
| "month" | | |
| | | |
| | A full textual representation of a | |
| | month, such as January or March | |
| | | |
| | | |
| | January through December | |
| | | |
| | | |
| 0 | | |
| | | |
| | Seconds since the Unix Epoch, simi- | |
| | lar to the values returned by | |
| | time(3) and used by date(3). | |
| | | |
| | System Dependent, typically | |
| | -2147483648 through 2147483647. | |
| | | |
+----------+--------------------------------------+---+
EXAMPLES
Example #1
getdate(3) example
<?php
$today = getdate();
print_r($today);
?>
The above example will output something similar to:
Array
(
[seconds] => 40
[minutes] => 58
[hours] => 21
[mday] => 17
[wday] => 2
[mon] => 6
[year] => 2003
[yday] => 167
[weekday] => Tuesday
[month] => June
[0] => 1055901520
)
SEE ALSO
date(3), idate(3), localtime(3), time(3), setlocale(3).
PHP Documentation Group GETDATE(3)