Created
March 29, 2012 15:56
-
-
Save ctrueden/2238895 to your computer and use it in GitHub Desktop.
I am an idiot who deserves public shame
This file contains hidden or 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
: curtis@sirius ~/code/ImageJ/imglib (master) | |
find . -exec sed -i '' -e 's/^M//' {} \; | |
sed: .: in-place editing only works for regular files | |
sed: ./.git: in-place editing only works for regular files | |
sed: ./.git/hooks: in-place editing only works for regular files | |
sed: ./.git/info: in-place editing only works for regular files | |
sed: ./.git/logs: in-place editing only works for regular files | |
sed: ./.git/logs/refs: in-place editing only works for regular files | |
sed: ./.git/logs/refs/heads: in-place editing only works for regular files | |
sed: ./.git/logs/refs/remotes: in-place editing only works for regular files | |
sed: ./.git/logs/refs/remotes/fiji: in-place editing only works for regular files | |
sed: ./.git/logs/refs/remotes/github: in-place editing only works for regular files | |
sed: ./.git/logs/refs/remotes/origin: in-place editing only works for regular files | |
sed: ./.git/logs/refs/remotes/pacific: in-place editing only works for regular files | |
sed: ./.git/objects: in-place editing only works for regular files | |
sed: ./.git/objects/00: in-place editing only works for regular files | |
sed: ./.git/objects/01: in-place editing only works for regular files | |
sed: ./.git/objects/02: in-place editing only works for regular files | |
sed: ./.git/objects/03: in-place editing only works for regular files | |
sed: ./.git/objects/04: in-place editing only works for regular files | |
sed: ./.git/objects/05: in-place editing only works for regular files | |
sed: ./.git/objects/06: in-place editing only works for regular files | |
sed: ./.git/objects/07: in-place editing only works for regular files | |
sed: ./.git/objects/08: in-place editing only works for regular files | |
^C | |
: curtis@sirius ~/code/ImageJ/imglib (master) | |
git status | |
error: bad index file sha1 signature | |
fatal: index file corrupt |
So doing sed on .git
accidentally will break that local git repo it looks like.
Yep. When shell scripting, make sure you only loop over the files you intend! One way here would have been find *
instead of find .
, since the *
glob does not match files starting with .
. (And sorry @MissValeska for the six-year delay in reply—I didn't notice your earlier comment till @MichaelCurrin's comment just now!)
Okay thanks I'll add to my notes.
Btw the in place editing regular files error is the reason I got here. I know now to use sed on files only using find -type f
I just added this section today while learning about sed and find
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I am confused, What is wrong with this?