Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Shell Script  (Read 4265 times)

0 Members and 1 Guest are viewing this topic.

Demon002

  • Guest
Shell Script
« on: August 29, 2009, 04:10:45 PM »
:) HI all, I just wrote my very first shell script in Ksh. ^.^ go me! Anyway its a very simple script which basically does 1 thing

It creates a new file and names it `hostname`.`date`.blah.blah (you get the point)

then

it pushes information to this file >>`hostname`.`date`.blah.blah

The issue is date includes TIME information there for is the script runs between minuets. i get 1 half the info in 1 file and the other half in another

gh0std0g74



    Apprentice

    Thanked: 37
    Re: Shell Script
    « Reply #1 on: August 29, 2009, 05:38:23 PM »
    save your date into a variable, if not, the next time you run date, it will have a different value
    Code: [Select]
    val=$(date)
    hostname=$(hostname)
    echo "test" >> ${hostname}${val}