Added material on how include files can change default behaviors and
interact with previous command line option selections.
1 parent 1e4308d commit 65d315bd3eef56e99b3c7ddcc841167f1588bd18
@tundra tundra authored on 17 Nov 2010
Showing 1 changed file
View
21
tren.rst
had been entered on the command line. For example, to replace
spaces in a filename with underscores, we have to quote the space
to preserve it as an argument to be passed to **tren**::
 
# 'tren' include to get rid of spaces in filenames
# nospace: 'tren' include to get rid of spaces in filenames
-i: -r' '=_ -r_-_=- -i0
 
- Watch out for situations where an include file changes default or
desired behavior. In the example above, the ``-i:`` is used to
force replacement of *all* instances of spaces. The ``-i0`` at
the end of the include resets **tren** to the default behavior
of only replacing the first instance of a matching old string.
That's fine if the include statement appears on the command line
in a place where the default behavior was in force. But look
what happens in a situation like this::
 
tren.py -i3 -rx=y -Inospace -ra=b ....
 
Prior to the include file being read, **tren** has been told to
replace the 4th instance of a matching string. After the
``nospace`` include file has been read, this gets reset to replace
the 1st instance of a matching old string. Make sure that's what
you want for the ``-ra=b`` renaming request.
 
- Most shells don't care if you leave a space between an option
and its argument. It's a really good idea to do so as a matter
of habit, especially when dealing with a complex command line
-----------------------------
 
::
 
$Id: tren.rst,v 1.199 2010/11/17 19:41:46 tundra Exp $
$Id: tren.rst,v 1.200 2010/11/17 19:52:56 tundra Exp $
 
You can find the latest version of this program at:
 
http://www.tundraware.com/Software/tren