bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

breakthrough: use $* instead of * in dired-do-shell-command


From: Dan Jacobson
Subject: breakthrough: use $* instead of * in dired-do-shell-command
Date: 02 Mar 2002 03:52:16 +0800
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1

[Below you just gotta accept my logic... "*" pales as a major
embarrassment in the towering shadow of my $* idea.]

Hi.  Last time we were arguing about *.  Indeed I always thought
there was something funny about giving such a commonly used shell
character "*" the special meaning for dired's "!".

(dired-do-shell-command "sh * q*/*" nil (quote ("mk_reply.sh")))

I wanted to do
$ sh mk_reply.sh q*/*
i.e. run this on all the files in all the directories starting with q.
but instead I end up doing
$ sh mk_reply.sh qmk_reply.sh/mk_reply.sh

so I think "who's the young punk who overloaded the * character so
that without a Ph.D. our brains are spinning, due to 20 years of
consistent meaning until that fateful date in dired"

Anyways, I'm just thinking, if say $*, $1... was chosen that fateful
day, instead of "*", it might have saved a lot of trouble [mental:
reprogramming ourselves, physical: "blast, I didn't mean that
command!"]... even though it is longer to type.  Wait... with $3 $8
etc. mapping too when you have used "!" on many marked dired files at
once, one is given more explicit control... [hmmm, hope the numbers
will be assigned to their position as seen in the dired buffer.]

In previous postings I was spouting that there was no way to escape
the *. [\*, \\*, \\\*...] But when you come to think about it, it is
the dired * that needs to be escaped, not the shell *, who is the
newcomer on the scene.

Perhaps my discovery of $* $@ $1 $2 ... in the dired "!" context are
the only choices that are guaranteed not to conflict with the users
usual usage or any other thing... but be sure to allow the user to
escape them this time... oh \$1 should be good enough... maybe also
'$1'... wait, yes, do it just like the shell... indeed maybe just send
the whole line to the shell one step earlier for parsing too... [so
"$@" would be different from "$*", the acid test.]

So, in Dan's world,
(dired-do-shell-command "echo first file is $1, second is $2, and all
are $*" nil (quote ("file1" "file2")))
would make:
first file is file1, second file is file 2, and all are file1 file2

Help says: If there is no `*', but a `?' in the command then it is
still run on each file individually but with the filename substituted
there instead of at the end of the command.

well ok, but also mention what happens if there are both * and ?, and
also mention how to escape ?.

Wait... how shall this ? functionality be remapped in my brand new
scheme of things?  I don't know.  The aforementioned $ stuff was a 10
second brain flash.  I leave thinking about ? to the pros [who
designed *... need new pros.]

Lastly, perhaps instead of calling my new command
dired-do-shell-command, maybe use another name... but anyway,
eventually that blasted "*" must be phased out from general user use,
as it will surely cause an accident one day [oops, i used M-! instead
of ! and...]
-- 
http://www.geocities.com/jidanni/ Taiwan(04)25854780



reply via email to

[Prev in Thread] Current Thread [Next in Thread]