[H-GEN] Useful not so obvious tips

ben.carlyle at invensys.com ben.carlyle at invensys.com
Mon Oct 25 05:10:10 EDT 2004


Sandra Mansell <fakungabubu at internode.on.net>
Sent by: general-bounces at lists.humbug.org.au
25/10/2004 04:13 PM
Please respond to general

 
        To:     HUMBUG General List <general at lists.humbug.org.au>
        cc: 
        Subject:        Re: [H-GEN] Useful not so obvious tips


> On Mon, Oct 25, 2004 at 03:46:37PM +1000, Stephen Thorne wrote:
> > Windows cmd.exe also does tab-completion and up-arrow for previous
> > commands. This was a refreshing change from the hell I usually
> > experience when forced to do DOS stuff.
> It's only Windows XP that supports this out of the box, but it's
> possible to edit the registry to give the same functionality to Windows
> 2000 as well. I had to do it on my work machine to keep myself sane with
> all the DOS hacking one of my previous jobs required.
...
> > Its kinda nice when you discover that Microsoft is only 10 years
> > behind on usable interfaces. :)

To be fair, this functionality has been around since I was a boy. As I 
recall, tab completion is fairly new but command history and some other 
editing nicities have been available for some time. In older versions you 
did need to type
$ doskey
first to turn it on. Presumably Windows XP now runs this program by 
default.

If I'm reading http://members.cox.net/bob.weeks/articles/hm50.htm 
correctly and it is to be trusted, doskey was introduced into dos 5.0 
(around the time of Windows 3.0).

Now to make this unix-related:

To pick up the xargs point, lets take David's find -exec example and 
convert it to use xargs:
$ find . -type f -exec do_something_interesting {} \;
becomes
$ find . -type f | xargs do_something_interesting

Simple, as long as your do_something application accepts more than one 
filename as a parameter. xargs will hand a "reasonable" number of 
parameters to each execution, while keeping in mind limits on the length 
of the command line for overly-long filenames. It can be more efficient. 
Instead of starting one invocation for each file, you might get half a 
dozen or more into one invocation. Be warned, however: Weird filenames 
(such as those containing spaces) can upset xargs when used in this mode.

Benjamin.





More information about the General mailing list