shithub: rc

ref: 6a179c0db1f31cbab6cff01639f9e7c73276ca92
dir: /surl/

View raw version
#!/bin/rc
#
# set site and surl then mkdir $surl
#
site=https://9p.sdf.org
surl=/usr/web/l

if(! test -d $surl){
	echo $surl does not exist.
	exit
}

echo -n 'surl: '
url=`{read}
if(! ~ $url ''){
	last=`{ls -rt $surl|awk -F/ '{print $5}'|tail -1}
	if(~ $last ''){
		last=0
	}
	last=`{echo $last|tr a-z A-Z}
	next=`{echo 'obase=16; ' $last+1 | bc}
	mkdir $surl/$next
	echo '<html><meta http-equiv=refresh content="0; url='$url'"></html>' > $surl/$next/index.html
	echo $site/l/$next
}