ref: 4f4b767fae09a76152d777ca1b5372218d6e5ff9
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 } }