Plan 9 from Bell Labs’s /usr/web/sources/contrib/fgb/rc/ctime

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


#!/bin/rc

rfork ne

uflag=()
while(! ~ $#* 0 && ~ $1 -*) {
	switch ($1) {
	case -u
		uflag=1
		shift
	case -*
		echo Usage: `{basename $0}  [-u] [when] >[1=2]
		exit usage	
	}
	shift
}

now=`{date $flag $1 | 
	sed '
		s/  ([0-9])/  0\1/
		s/Jan/01/
		s/Feb/02/
		s/Mar/03/
		s/Apr/04/
		s/May/05/
		s/Jun/06/
		s/Jul/07/
		s/Aug/08/
		s/Sep/09/
		s/Oct/10/
		s/Nov/11/
		s/Dec/12/'}

if(~ $uflag 1)
	echo $now(6)^-^$now(2)^-^$now(3)^T^$now(4)^Z
if not
	echo $now(6)^$now(2)^$now(3)

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.