Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Is echo $variable >> text.txt working in MacOSX? Post 302375251 by Neo on Friday 27th of November 2009 05:16:54 AM
Old 11-27-2009
Quote:
Originally Posted by jackt
Is echo $variable >> text.txt working in MacOSX?
Yes, it works fine, but <TIME> is not supported, I don't think. Try date instead.


Code:
newdate=$(date)
echo $newdate >> /Users/ttadmin/Desktop/test.txt

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

echo "ABC" > file1.txt file2.txt file3.txt

Hi Guru's, I need to create 3 files with the contents "ABC" using single command. Iam using: echo "ABC" > file1.txt file2.txt file3.txt the above command is not working. pls help me... With Regards / Ganapati (4 Replies)
Discussion started by: ganapati
4 Replies

2. Shell Programming and Scripting

echo 2 txt files to screen no carraige return

I have two text files, each of then only containing ONE line and NO carraige return or white space at the end...how do I echo both of these text files to the screen without putting an extra line? I want to do this from the command line. file1.txt: this is file1.txt 1 file2.txt: this is... (4 Replies)
Discussion started by: ajp7701
4 Replies

3. Shell Programming and Scripting

Echo working funny

Hello, this is my first post and question. I have search before for this problem but didn't find anything similar. My case: I have a string inside the variable string1 like this: string1="lala lele lili lolo lulu" When I do echo of it, it appears like this: echo $string1 lala lele lili... (8 Replies)
Discussion started by: hemtar
8 Replies

4. Shell Programming and Scripting

echo is not working as expected

for i in `cat /export/home/afahmed/Arrvial_time.txt` do echo $i echo $i | awk '$3 < $D { print $4 }' >> dynamic_DF.txt; done When i echo, its echo as Nov 15 02:24 /export/home/pp_adm/inbound//wwallet_20111115.txt where i expect it to be Nov 15 02:24... (7 Replies)
Discussion started by: afahmed
7 Replies

5. Shell Programming and Scripting

How to echo $variable into txt file?

Hello i tried many times echo $variables into text file with no success for example: echo "#!/bin/sh BBHTAG=RFOCLT_check # What we put in bb-hosts to trigger this test COLUMN=RFOCLT # Name of the column, often same as tag in bb-hosts $BBHOME/bin/bbhostgrep $BBHTAG | while read... (5 Replies)
Discussion started by: mogabr
5 Replies

6. Shell Programming and Scripting

Echo variable contents into a text file...

Hi all, I am trying to create a script to read my Windows UUIDs and create mounts in fstab. I know there are different and maybe even better ways to mount Windows partitions at boot time, but I always manually create them in fstab successfully. I do a clean install of Ubuntu often and would like to... (2 Replies)
Discussion started by: Ian Pride
2 Replies

7. Windows & DOS: Issues & Discussions

2 Questions: replace text in txt file, add text to end of txt file

so... Lets assume I have a text file. The text file contains multiple "#" symbols. I want to replace all thos "#"s with a STRING using DOS/Batch I want to add a certain TEXT to the end of each line. How can I do this WITHOUT aid of sed, grep or anything linux related ? (1 Reply)
Discussion started by: pasc
1 Replies

8. Shell Programming and Scripting

Echo not working with $

$cat FILE.txt $PATH1/file1.txt $PATH2/file2.txt where$PATH 1 = /root/FILE_DR/file1.txt $PATH 2 = /root/FILE_DR/file2.txt for I in `cat FILE.txt` do v=`echo $I` echo $v if then rm $v (5 Replies)
Discussion started by: ekharvi
5 Replies

9. Shell Programming and Scripting

Echo command not working in the script

HI I have and echo command which works perfectly in the shell but when i execute in the script it gives me an error code query is as below QUERY=`echo "Select Severity,Dupl_count,Creation_Time,Last_Received,Node_Name,Node_Name,Object,Message_Group,Message_Text,Last_Annotation from " \ ... (2 Replies)
Discussion started by: Jcpratap
2 Replies

10. Shell Programming and Scripting

Search last column of INPUT.txt in TABLEs text and add correspond columns to INPUT.txt

Hi dears i use bash shell i have INPUT.txt like this number of columns different in one some row have 12 , some 11 columns see last column INPUT.txt CodeGender Age Grade Dialect Session Sentence Start End Length Phonemic Phonetic 63 M 27 BS/BA TEHRANI 3 4 298320 310050... (2 Replies)
Discussion started by: alii
2 Replies
DATETIME.ADD(3) 							 1							   DATETIME.ADD(3)

DateTime::add - Adds an amount of days, months, years, hours, minutes and seconds to a DateTime object

       Object oriented style

SYNOPSIS
public DateTime DateTime::add (DateInterval $interval) DESCRIPTION
Procedural style DateTime date_add (DateTime $object, DateInterval $interval) Adds the specified DateInterval object to the specified DateTime object. PARAMETERS
o $object -Procedural style only: A DateTime object returned by date_create(3). The function modifies this object. o $interval - A DateInterval object RETURN VALUES
Returns the DateTime object for method chaining or FALSE on failure. EXAMPLES
Example #1 DateTime.add(3) example Object oriented style <?php $date = new DateTime('2000-01-01'); $date->add(new DateInterval('P10D')); echo $date->format('Y-m-d') . " "; ?> Procedural style <?php $date = date_create('2000-01-01'); date_add($date, date_interval_create_from_date_string('10 days')); echo date_format($date, 'Y-m-d'); ?> The above examples will output: 2000-01-11 Example #2 Further DateTime.add(3) examples <?php $date = new DateTime('2000-01-01'); $date->add(new DateInterval('PT10H30S')); echo $date->format('Y-m-d H:i:s') . " "; $date = new DateTime('2000-01-01'); $date->add(new DateInterval('P7Y5M4DT4H3M2S')); echo $date->format('Y-m-d H:i:s') . " "; ?> The above example will output: 2000-01-01 10:00:30 2007-06-05 04:03:02 Example #3 Beware when adding months <?php $date = new DateTime('2000-12-31'); $interval = new DateInterval('P1M'); $date->add($interval); echo $date->format('Y-m-d') . " "; $date->add($interval); echo $date->format('Y-m-d') . " "; ?> The above example will output: 2001-01-31 2001-03-03 NOTES
DateTime.modify(3) is an alternative when using PHP 5.2. SEE ALSO
DateTime.sub(3), DateTime.diff(3), DateTime.modify(3). PHP Documentation Group DATETIME.ADD(3)
All times are GMT -4. The time now is 01:07 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy