move 676 B

12345678910111213141516171819202122232425262728293031
  1. #!/bin/rc
  2. # patch/move target patch-tree... - move patch tree(s) to target dir
  3. rfork e
  4. pats=/n/sources/patch
  5. if(~ $#* 0 1){
  6. echo 'usage: patch/move dst patch-name...' >[1=2]
  7. exit usage
  8. }
  9. if(! test -d $pats){
  10. rfork n
  11. 9fs sources
  12. }
  13. cd $pats
  14. dst=$1
  15. shift
  16. for(src){
  17. patbase = `{basename $src}
  18. patdest = $dst/$patbase
  19. if (~ $dst $src $patbase)
  20. echo $0: skipping $src >[1=2]
  21. if not if(! test -d $src)
  22. echo $0: no such patch $pats/$src >[1=2]
  23. if not if(test -d $patdest)
  24. echo $0: already have $pats/$patdest >[1=2]
  25. if not
  26. ls -ldp $src >$src/origls &&
  27. mkdir $patdest && dircp $src $patdest && rm -rf $src &&
  28. test -s $patdest/email && patch/notify $patdest
  29. }