Gentoo Archives: gentoo-user

From: Philip Webb <purslow@××××××××.net>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] bash date puzzle
Date: Mon, 14 Nov 2011 11:14:58
Message-Id: 20111114111334.GA3002@ca.inter.net
In Reply to: Re: [gentoo-user] bash date puzzle by Neil Bothwick
1 111114 Neil Bothwick wrote:
2 > On Mon, 14 Nov 2011 02:06:04 -0500, Philip Webb wrote:
3 >> To convert a UNIX date to a human-readable version the command is :
4 >> 556: ~> date -d @1321251520
5 >> Mon Nov 14 01:18:40 EST 2011
6 >> I would like to create a Bash alias or function to do this,
7 >> but can't get the Bash syntax right: it keeps telling me
8 >> "date: the argument `1321251520' lacks a leading `+';
9 > It is difficult to say what is wrong with your alias
10 > as you haven't shown it
11
12 alias th='date -d @$1'
13
14 was the first try, then adding '+' &/or '\' to escape '+' or '@'.
15 I also tried a function along similar lines.
16
17 > but my guess is that is is introducing a space
18 > between @ and the timestamp, which gives exactly the error you get.
19
20 No, no spaces.
21
22 --
23 ========================,,============================================
24 SUPPORT ___________//___, Philip Webb
25 ELECTRIC /] [] [] [] [] []| Cities Centre, University of Toronto
26 TRANSIT `-O----------O---' purslowatchassdotutorontodotca

Replies

Subject Author
Re: [gentoo-user] bash date puzzle Paul Colquhoun <paulcol@×××××××××××××××××.au>
Re: [gentoo-user] bash date puzzle Willie Wong <wwong@××××××××××××××.edu>
Re: [gentoo-user] bash date puzzle Neil Bothwick <neil@××××××××××.uk>