Sponsored Content
Full Discussion: Bash Script error?
Top Forums Shell Programming and Scripting Bash Script error? Post 302139172 by vgersh99 on Thursday 4th of October 2007 03:51:11 PM
Old 10-04-2007
Quote:
Originally Posted by JayC89
Like so?

Code:
    echo no date provided, defaulting to today $d/$m/$y
    ENDDATE=`date +%d/%m/%Y`

that's right
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

error in bash script 'if' loop

SEND_MESSAGE=test echo $SEND_MESSAGE if then echo `date` > update_dt_ccaps.lst echo "The file transfer failed" >> update_dt_ccaps.lst SEND_MESSAGE=false fi The above code is showing error in bash shell as : ./test: line 5: [: test: integer expression expected ... (2 Replies)
Discussion started by: DILEEP410
2 Replies

2. Shell Programming and Scripting

Help in error seen in the Bash script

Hi, I am currently encounter an error of:- ./max.bash: line 45: then max=0 else max=$maximum It seems that it does not allow max to assigned with floating numbers. Please help. Thanks. (2 Replies)
Discussion started by: ahjiefreak
2 Replies

3. Shell Programming and Scripting

BASH Script syntax error

I'm trying to write a simple script that takes all the .tar.gz files in a directory and verifies them by using the gzip -tv command: for zip in *.tar.gz do gzip -tv $zip if ; then #Check return code from tar echo "File ${zip} verified OK." exit... (4 Replies)
Discussion started by: kelldan
4 Replies

4. Shell Programming and Scripting

Strange error in bash script

Howdy all, I have a scritp that does a sqldump. But for some goofy reason, a certain part of it behaves uber strange. It does a daily dump of my sql, according to parameters I enter in hardcode. The script is: #!/bin/bash APP_NAME="app_com_site" wikiname="wiki_com_site" ... (8 Replies)
Discussion started by: saariko
8 Replies

5. Shell Programming and Scripting

FTP script error in BASH

Hi All, I have a script which is supposed to connect to Windows machine and FTP a file into LINUX. Script is like below #!/usr/bin/sh ParamterFle=${1} //grepping all parameters BossFtpLog=${2} // assigning log file ftp -i -n host_name << EOF user1 password1 cd /drive1/drive2 get... (6 Replies)
Discussion started by: Raamc
6 Replies

6. Shell Programming and Scripting

Bash script error problem

Im in a intro to unix class and we have to create a a basic program to look up an argument in a large file. when no argument is given he wants us to produce a error messgae, well this works but it also produces another error message because my variable now equals nothing. #! /bin/bash ... (3 Replies)
Discussion started by: laxkrzy
3 Replies

7. Shell Programming and Scripting

Getting error on for loop - bash script

Hi, I am working on bash script after a long time. I am getting error near done statement while running a for loop snippet. The error says "Syntax error near unexpcted token 'done'" please suggest what could be wrong. here is the snippet elements=${#option_arr} //an array of values... (1 Reply)
Discussion started by: arundhati_s
1 Replies

8. Shell Programming and Scripting

Error with Audio Conversion Bash Script

Good evening, I'm currently working on a BASH script to convert audio between file formats and I've come across a snag. At the beginning of the script, I'm having the system check to see if any files with the .m4a extension exist in the directory, and if so, it runs the script. If there are no... (1 Reply)
Discussion started by: KBurkholder
1 Replies

9. Shell Programming and Scripting

How to block first bash script until second bash script script launches web server/site?

I'm new to utilities like socat and netcat and I'm not clear if they will do what I need. I have a "compileDeployStartWebServer.sh" script and a "StartBrowser.sh" script that are started by emacs/elisp at the same time in two different processes. I'm using Cygwin bash on Windows 10. My... (3 Replies)
Discussion started by: siegfried
3 Replies

10. Shell Programming and Scripting

Bash on Fedora error on basic script

I am not able to execute bash script on Fedora. They were running on another environment. This is a sample script: #!/usr/bin/bash input="./data/heu/hout1" i=1 j=0 while IFS= read -r file1 do #Some code here done < "$input" #echo $j I get an error: bash: s.sh: command not... (3 Replies)
Discussion started by: ngabrani
3 Replies
DATETIME.__CONSTRUCT(3) 						 1						   DATETIME.__CONSTRUCT(3)

DateTime::__construct - Returns new DateTime object

       Object oriented style

SYNOPSIS
public DateTime::__construct NULL ([string $time = "now"], [DateTimeZone $timezone]) DESCRIPTION
Procedural style DateTime date_create NULL ([string $time = "now"], [DateTimeZone $timezone]) Returns new DateTime object. PARAMETERS
o $time -A date/time string. Valid formats are explained in Date and Time Formats. Enter NULL here to obtain the current time when using the $timezone parameter. o $timezone - A DateTimeZone object representing the timezone of $time. If $timezone is omitted, the current timezone will be used. Note The $timezone parameter and the current timezone are ignored when the $time parameter either is a UNIX timestamp (e.g. @946684800) or specifies a timezone (e.g. 2010-01-28T15:00:00+02:00). RETURN VALUES
Returns a new DateTime instance. Procedural style returns FALSE on failure. ERRORS
/EXCEPTIONS Emits Exception in case of an error. CHANGELOG
+--------+---------------------------------------------------+ |Version | | | | | | | Description | | | | +--------+---------------------------------------------------+ | 5.3.0 | | | | | | | If $time contains an invalid date/time format, | | | then an exception is now thrown. Previously an | | | error was emitted. | | | | +--------+---------------------------------------------------+ EXAMPLES
Example #1 DateTime.__construct(3) example Object oriented style <?php try { $date = new DateTime('2000-01-01'); } catch (Exception $e) { echo $e->getMessage(); exit(1); } echo $date->format('Y-m-d'); ?> Procedural style <?php $date = date_create('2000-01-01'); if (!$date) { $e = date_get_last_errors(); foreach ($e['errors'] as $error) { echo "$error "; } exit(1); } echo date_format($date, 'Y-m-d'); ?> The above examples will output: 2000-01-01 Example #2 Intricacies of DateTime.__construct(3) <?php // Specified date/time in your computer's time zone. $date = new DateTime('2000-01-01'); echo $date->format('Y-m-d H:i:sP') . " "; // Specified date/time in the specified time zone. $date = new DateTime('2000-01-01', new DateTimeZone('Pacific/Nauru')); echo $date->format('Y-m-d H:i:sP') . " "; // Current date/time in your computer's time zone. $date = new DateTime(); echo $date->format('Y-m-d H:i:sP') . " "; // Current date/time in the specified time zone. $date = new DateTime(null, new DateTimeZone('Pacific/Nauru')); echo $date->format('Y-m-d H:i:sP') . " "; // Using a UNIX timestamp. Notice the result is in the UTC time zone. $date = new DateTime('@946684800'); echo $date->format('Y-m-d H:i:sP') . " "; // Non-existent values roll over. $date = new DateTime('2000-02-30'); echo $date->format('Y-m-d H:i:sP') . " "; ?> The above example will output something similar to: 2000-01-01 00:00:00-05:00 2000-01-01 00:00:00+12:00 2010-04-24 10:24:16-04:00 2010-04-25 02:24:16+12:00 2000-01-01 00:00:00+00:00 2000-03-01 00:00:00-05:00 SEE ALSO
DateTime.createFromFormat(3), DateTimeZone.__construct(3), Date and Time Formats, date.timezone ini setting, date_default_time- zone_set(3), DateTime.getLastErrors(3), checkdate(3). PHP Documentation Group DATETIME.__CONSTRUCT(3)
All times are GMT -4. The time now is 07:35 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy