environment.sh 462 B

123456789101112131415161718192021222324
  1. FILE="development.xcconfig"
  2. if [ ! -f "$FILE" ]; then
  3. echo ".xcconfig file not found!"
  4. exit 0;
  5. fi
  6. KEY_ARRAY=()
  7. while IFS= read -r line; do
  8. if [[ $line != //* ]] && [[ $line == *"="* ]]; then
  9. IFS=' = ' read -r -a array <<< "$line"
  10. KEY_ARRAY+=("${array[0]}")
  11. fi
  12. done < "$FILE"
  13. for i in "${KEY_ARRAY[@]}"
  14. do
  15. if [ -n "${!i}" ]; then
  16. echo "Key : ${i}"
  17. echo "Value : ${!i}"
  18. sed -i '' "s/\(^${i}=\).*/\1${!i}/" "$FILE"
  19. fi
  20. done
  21. exit 0;