Skip to content
This repository was archived by the owner on Oct 26, 2025. It is now read-only.
This repository was archived by the owner on Oct 26, 2025. It is now read-only.

New hook: remove unicode quotes #6

@danielhoherd

Description

@danielhoherd

Add a hook to replace unicode quotes with normal quotes. EG:

$ cat ~/code/dho-bin/fix-shitty-quotes.sh
#!/usr/bin/env bash
# shellcheck disable=SC1111
# Purpose: Remove unicode quotes from content.
# Caveats: This is just a dump search/replace. It does not account for quoted
#          content that will be misquoted after removing unicode quotes.

if [ "${#@}" -lt 1 ]; then
    echo "Replaces shitty quotes with normal quotes in all given files"
    echo "example: grep -rl '[“”’]' | xargs ${0##*/}"
    exit 1
fi

if [ "$(uname)" == 'Darwin' ]; then
    [ ! -e /usr/local/bin/gsed ] && {
        echo "GNU sed is required because bsd sed is lame."
        exit 1
    }
    /usr/local/bin/gsed -i 's/[“”]/"/g' "$@"
    /usr/local/bin/gsed -i "s/’/'/g" "$@"
else
    sed -i 's/[“”]/"/g' "$@"
    sed -i "s/’/'/g" "$@"
fi

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions