cfg_edit.sh 503 B

123456789101112131415161718
  1. #!/bin/sh
  2. # Invoked from cfg_defs.sh as a filter
  3. # Strip leading and trailing whitespace
  4. # Escape any iternal '\'
  5. # Escape any iternal '"'
  6. # Entify any iternal '&', '<' or '>'
  7. # Append a '=' if none present'
  8. # Break into two strings at '='
  9. # Prefix ' { "' and suffix '" },'
  10. sort |
  11. sed -e 's!^[ ]*!!' -e 's![ ]*$!!' \
  12. -e 's!\\!\\\\!g' \
  13. -e 's!"!\\"!g' \
  14. -e 's!&!\&amp;!g' -e 's!<!\&lt;!g' -e 's!>!\&gt;!g' \
  15. -e 's!^[^=]*$!&=!' \
  16. -e 's!=!", "!' \
  17. -e 's!^! { "!' -e 's!$!" },!'