Re: [SLUG] bash script problem

From: Kwan Lowe (kwan@digitalhermit.com)
Date: Wed Oct 05 2005 - 21:24:33 EDT


>
> man date says: "date - print or set the system date and time"
> It prints the system time, but getting it into a variable
> seems to be my problem.
> I have tried everything that I can think of including:
> touch < date (+formatting info)
>
> Can anyone please point me in the proper direction?

You need to grab the output of date. The thing you're missing is the backtick (`)
operator.

  #!/bin/sh
  datefield=`date +%Y%M%d`
  filename=FOO.${datefield}
  touch $filename

-- 
* The Digital Hermit   http://www.digitalhermit.com
* Unix and Linux Solutions   kwan@digitalhermit.com
-----------------------------------------------------------------------
This list is provided as an unmoderated internet service by Networked
Knowledge Systems (NKS).  Views and opinions expressed in messages
posted are those of the author and do not necessarily reflect the
official policy or position of NKS or any of its employees.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 17:57:22 EDT