Timeline for Backup file with .bak _before_ filename extension
Current License: CC BY-SA 3.0
10 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Feb 28, 2013 at 11:38 | comment | added | dotancohen | I need this to work in standard Bash anyway. | |
| Feb 28, 2013 at 11:38 | vote | accept | dotancohen | ||
| Feb 28, 2013 at 10:29 | comment | added | Johan | I know that zsh allows for some very clever in-place substitutions on the command-line, though I'm not sure if it works like this exactly. I think it is called global aliases .... maybe one of the local zsh gurus will pick this up? | |
| Feb 28, 2013 at 9:45 | comment | added | dotancohen |
@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.
|
|
| Feb 28, 2013 at 8:21 | comment | added | Johan | @Bernhard Heh why didn't I think of that!? | |
| Feb 28, 2013 at 8:19 | comment | added | Bernhard |
Why not just cp file{,.bak}.ext then?
|
|
| Feb 28, 2013 at 7:56 | comment | added | Johan | 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. | |
| Feb 28, 2013 at 7:55 | history | edited | Johan | CC BY-SA 3.0 |
Changed the sub-script to catre for files that doesn't have an extention.
|
| Feb 28, 2013 at 7:50 | comment | added | Johan | 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... | |
| Feb 28, 2013 at 7:45 | history | answered | Johan | CC BY-SA 3.0 |