Write system variables into file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Write system variables into file
# 1  
Old 10-28-2003
Question Write system variables into file

Hi everyone,

I was told, i my job, to do a script that creates the backup of all the files that are important to us.
So i created the script, put it in the crontab and it works great.

Now what i want is to write to a file what directories have being copied with date and time.
How can i write to a file the present date and time?

This is the script i have:

echo "Backup OK in Dir /CTA: " date + "%d - %m - %Y at %T" > ./imp.txt

This should write to imp.txt file for example:
Backup OK in Dir /CTA: 28-10-2003 at 03:30:00

Can anyone help?

Thanx a lot

Jorge Ferreira
# 2  
Old 10-28-2003
to echo the date of the files last modification, you could put the results of
'ls -lt filename

in a variable, then to get the date and time out alone youd have to do some type of awk or sed trickery (hehe sorry im not goodwith those).

to simply print the current date and time :
echo `date`


sorry for my lack of text manipulation knowledge! but dont worry someone else here will be able to tell you just how to do what you need.
# 3  
Old 10-28-2003
You don't need to use echo...

date "+Backup OK in Dir /CTA: %d - %m - %Y at %T"
# 4  
Old 10-28-2003
Problem solved

Thank you Gentlemen for your time:
Ygor and Norsk Hedensk

Thanx for the tip Ygor. It really works.

Jorge Ferreira
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How can I write variables to same line of a file?

I am trying to keep variables in a file. if I have all variables at the same time, I can write them all like below. echo $var1","$var2","$var3 But, these variables are being calculated at different times then they are lost so I want to keep them in a file seperated by "," . echo... (5 Replies)
Discussion started by: snr_silencer
5 Replies

2. AIX

Write once on NFS file system

Hello Guru's We are trying to save some data for 10 -15 yrs. so we created a NFS share file system and mounted on AIX 5.3 servers, keeping in mind that we might need to replace the expired disk/bad disk every 2 yrs or 4 yrs. Now we are trying to solve. How to protect it from getting deleted... (6 Replies)
Discussion started by: Beginner123
6 Replies

3. Shell Programming and Scripting

Write string variables to file

I have the following: #! /bin/bash foo="bar" this="that" vars="foovar=$foo\n\ thisvar=$this\n" I want to write the following to a file: foovar="bar" thisvar="that" Then in another script, I pull this file, and loop through it: while read line; do eval $line done <... (3 Replies)
Discussion started by: Validatorian
3 Replies

4. Shell Programming and Scripting

How do write using variables

Hello Team, I have the following line in a .sh file .That means if we add my file.sh file to crontab .The crontab will read the first line where the db2 profile is installed.Can some body help me how to recode this using a variable ? That means the below path is static to a perticular... (3 Replies)
Discussion started by: rocking77
3 Replies

5. SCO

Read and write into file system from SCO

hi Knows someone what kind of file system uses SCO Unix 5.0.6? Which linux or unix LIVE CD can read and write into file system from SCO Unix? I've tried to boot SCO using Knoppix 6.2.1 LIVE CD, but cannot mount. # mount -t sysv /dev/sda1 /mnt mount: wrong fs type, bad option, bad superblock... (2 Replies)
Discussion started by: ccc
2 Replies

6. Shell Programming and Scripting

how to write 2 variables while using read command

Hello All i have input files contains 2 values as following 20-Oct-09 Z59408009 20-Oct-09 Z59423060 and i am using the following script cat /home/or/input.txt | awk '{print $2}' >log count=0 while read line; do count=$(( count + 1 )) echo "UPDATE SAT_JRLTRT SET AVT='X' WHERE... (6 Replies)
Discussion started by: mogabr
6 Replies

7. SCO

file system not getting mounted in read write mode after system power failure

After System power get failed File system is not getting mounted in read- write mode (1 Reply)
Discussion started by: gtkpmbpl
1 Replies

8. Solaris

fssnap error :snapshot error: File system could not be write locked

Hi Guys. This is part of my filesystem structure : Filesystem size used avail capacity Mounted on /dev/md/dsk/d0 47G 5.2G 42G 12% / /devices 0K 0K 0K 0% /devices ctfs 0K 0K 0K 0% ... (2 Replies)
Discussion started by: aggadtech08
2 Replies

9. Filesystems, Disks and Memory

Export a file system with write permissions

Hi, Is there a way we can export a file system with write permissions for only one user. For eg. we have many users on the network, but only user2 should have write permissions on the exported file system and for others it should be read-only. (7 Replies)
Discussion started by: jredx
7 Replies

10. UNIX for Dummies Questions & Answers

/: write failed, file system full

Sun server 4 Getting message /: write failed, file system full. Okay so the problem seems obvious. The file system is full. This server is used for DNS and DHCP on a T1 connected WAN. I can't get it to quit displaying the same message as above, even when powered down and restarted. So... (1 Reply)
Discussion started by: lancest
1 Replies
Login or Register to Ask a Question