text-to-cpp-string.sh 202 B

1234567891011
  1. #!/bin/sh
  2. # $1 name of the variable
  3. # $2 input path
  4. echo "extern const char $1[];"
  5. echo -n "const char $1[] = R\"("
  6. grep -v '^ *#' < "$2" | while IFS= read -r line; do
  7. echo "$line"
  8. done
  9. echo ")\";"