Last active
May 22, 2023 02:07
-
-
Save hasn-prevas/01e2f7af5410bb7b8e2f4ec215d814d1 to your computer and use it in GitHub Desktop.
Shell script to add UTF-8 BOM to any file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
BOM='\xEF\xBB\xBF' | |
if ! sed -n "1{/^$BOM/q1}" "$1"; then | |
echo "Already has BOM" >&2 | |
exit 1 | |
fi | |
sed -i "1s/^/$BOM/" "$1" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
add bom to all jsp file in project
find . -name "*.jsp" -exec ./add-bom.sh {} ;