Useful CLI tools (bash) for Arch Linux administration
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

14 lines
514 B

6 years ago
  1. #!/bin/bash
  2. special=$'`!@#$%^&*()-_+={}|[]\\;\':",.<>?/ '
  3. for ((i=0; i < ${#special}; i++)); do
  4. char="${special:i:1}"
  5. printf -v q_char '%q' "$char"
  6. if [[ "$char" != "$q_char" ]]; then
  7. printf 'Yes - character %s needs to be escaped\n' "$char"
  8. else
  9. printf 'No - character %s does not need to be escaped\n' "$char"
  10. fi
  11. done | sort
  12. # Author: codeforester
  13. # https://stackoverflow.com/questions/15783701/which-characters-need-to-be-escaped-in-bash-how-do-we-know-it/44581064#44581064