ref: e467b6f5ab07f5bea9049d1cb5f61d8d3846928b
dir: /bin/new/
#!/bin/rc -e rfork e fn usage {>[1=2] echo 'usage:' $usage && exit 'usage'} usage='new [file]' mode = 755 skeldir = $home/skel skel = $skeldir/rc while(~ $1 -* && ! ~ $1 --){ switch($1){ case -m mode = $2 shift case --* skel = $skeldir/`{echo $1 | sed 's/^--//'} } shift } if(~ $1 --) shift files = $* if(~ $#files 0) files =`{fortune <{</lib/words awk 'length($0) == 3 {print tolower($0)}'}} for(f in $files){ if(~ $f */*) mkdir -p `{echo $f | sed 's@(.*)/.*$@\1@'} if(test -e $f) >[1=2] echo 'file exists:' $f if not{ echo $f cat $skel >$f chmod $mode $f plumb -d edit $f } }