'\240`: command not foundClearly you need to clean the code and here is one of the methods to do so. It is just a POB as usual:
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/bash -e | |
# nbsp2sp.sh | |
filePath=$1 | |
USAGE="Usage: `basename $0` <filePath>" | |
if [ $# -ne "1" ] | |
then | |
echo $USAGE | |
exit 1 | |
fi | |
tr '\240' ' ' < $filePath > /tmp/tmp && mv /tmp/tmp $filePath |
However if you are serious about posting code snippets I recommend using gist. Just paste your code or add modifications in the future. You can copy the content from "Embed this gist" which is a script tag you can directly paste in your blog. The code above is coming from nbsp2sp.sh gist.
No comments:
Post a Comment