Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

7
  • Note that the section where the sub-script tests to see if $FILE is the same as $EXTN simply squashes EXTN. I notice there is a mistake, it requires that the . be inside the EXTENTION variable... A slight modification will take care of that automatically... Commented Feb 28, 2013 at 7:50
  • In this final version the script correctly handles files without an extention too. It will generate two names, eg file and file.bak in those cases. Commented Feb 28, 2013 at 7:56
  • 7
    Why not just cp file{,.bak}.ext then? Commented Feb 28, 2013 at 8:19
  • @Bernhard Heh why didn't I think of that!? Commented Feb 28, 2013 at 8:21
  • @Bernard: Perfect! Now I need to find a standard (i.e. non-VIM) Bash shortcut to go back to the previous . character and I'll be in backup Nirvana. Commented Feb 28, 2013 at 9:45