move 547 B

12345678910111213141516171819202122232425
  1. #!/bin/rc
  2. if(~ $#* 0 1){
  3. echo 'usage: patch/move dst patch-name...' >[1=2]
  4. exit usage
  5. }
  6. if(! test -d /n/sources/patch){
  7. rfork n
  8. 9fs sources
  9. }
  10. dst=$1
  11. shift
  12. for(i){
  13. if(! test -d /n/sources/patch/$i)
  14. echo 'no such patch' /n/sources/patch/$i >[1=2]
  15. if not if(test -d /n/sources/patch/$dst/$i)
  16. echo 'already have' /n/sources/patch/$dst/$i >[1=2]
  17. if not
  18. ls -ldp /n/sources/patch/$i >/n/sources/patch/$i/origls &&
  19. mkdir /n/sources/patch/$dst/$i &&
  20. dircp /n/sources/patch/$i /n/sources/patch/$dst/$i &&
  21. rm -rf /n/sources/patch/$i
  22. }