On Sat, Jun 12, 2010 at 21:02, Marius Hofert m_hofert@web.de wrote:
I have a file with a certain extension. In the folder where this file is located, there is a file with the same name but extension .pdf. How do I create a command that removes the .pdf? My first trial was this (bundle editor):
- Save: Current File
- Command(s): rm "$TM_FILENAME/Rd/pdf"
- Input: None
- Output: Discard
So I guess 2) is the problem. How can I replace the file extension by .pdf?
Try this: rm "${TM_FILEPATH/%Rd/pdf}"
* The braces are part of the shell syntax for pattern replacement. * Prefixing the pattern with `%` makes sure it only matches the end of the expanded string. * $TM_FILENAME contains just the `basename` of the current file, use $TM_FILEPATH for its absolute path.
HTH, Martin