tr-works 665 B

12345678910111213141516171819202122232425262728
  1. # FEATURE: CONFIG_FEATURE_TR_CLASSES
  2. run_tr ()
  3. {
  4. $ECHO -n "echo '$1' | tr '$2' '$3': "
  5. echo "$1" | $bb tr "$2" "$3"
  6. echo
  7. }
  8. tr_test ()
  9. {
  10. run_tr "cbaab" abc zyx
  11. run_tr "TESTING A B C" '[A-Z]' '[a-z]'
  12. run_tr "abc[]" "a[b" AXB
  13. run_tr abc '[:alpha:]' A-ZA-Z
  14. run_tr abc56 '[:alnum:]' A-ZA-Zxxxxxxxxxx
  15. run_tr 012 '[:digit:]' abcdefghi
  16. run_tr abc56 '[:lower:]' '[:upper:]'
  17. run_tr " " '[:space:]' 12345
  18. run_tr " " '[:blank:]' 12
  19. run_tr 'a b' '[= =]' X
  20. run_tr "[:" '[:' ab
  21. run_tr " .,:" '[:punct:]' 12
  22. run_tr " .,:" '[:cntrl:]' 12
  23. }
  24. bb= tr_test > logfile.gnu
  25. bb=busybox tr_test > logfile.bb
  26. diff -u logfile.gnu logfile.bb