Disable GNU Indent backup files

gnuindentation

I am using GNU Indent to format C code in my project.

By default backup files are created ending with a ~.

I don't want to have any backup files created, is there a way to disable it?

Best Answer

Looking through the man page for indent and the official GNU documentation I only see 2 methods for controlling this behavior.

The environment variables:

  • SIMPLE_BACKUP_SUFFIX
  • VERSION_WIDTH

I tried various tricks of setting the width to 0 and also setting the SIMPLE_BACKUP_WIDTH to nothing (""). Neither had the desired effect. I think you're only course of action would be to create a shell alias and/or function to wrap the command indent to do what you want.

Example

$ function myindent() { indent "$@"; rm "$@"~; }

Then when I run it:

$ myindent ev_epoll.c

I get the desired effect:

$ ls -l | grep ev_epo
-rw-r--r--.   1 saml saml     7525 Dec 13 18:07 ev_epoll.c
Related Question