fork download
  1. #! /bin/sh
  2.  
  3. # ed -- add encryption to ed
  4.  
  5. CMD="/usr/bin/ed"; ENCRYPT="F"
  6.  
  7. while [ "$(expr substr $1X 1 1)X" = "-X" ]
  8. do case $1 in
  9. -x) ENCRYPT="T"; shift;;
  10. -p) CMD="$CMD $1 $2"; shift; shift;;
  11. *) CMD="$CMD $1"; shift;;
  12. esac
  13. done
  14.  
  15. if [ "$ENCRYPT" = "F" ]
  16. then $CMD "$*"
  17. else stty -echo
  18. echo -n "Enter password: "
  19. read PASS1
  20. echo ""
  21. echo -n "Repeat password: "
  22. read PASS2
  23. echo ""
  24. stty echo
  25. if [ "$PASS1" != "$PASS2" -o "X$PASS1" = "X" ]
  26. then echo "Password error" >&2; exit 1
  27. fi
  28. echo $PASS1 | ccdecrypt -k - $1
  29. $CMD $1
  30. echo $PASS2 | ccencrypt -k - $1
  31. mv $1.cpt $(basename $1 .cpt)
  32. fi
Runtime error #stdin #stdout #stderr 0s 4568KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Permission denied