What we did at UBZ
John A Meinel
john at arbash-meinel.com
Fri Nov 18 15:57:11 GMT 2005
Martin Pool wrote:
> On 18 Nov 2005, Michael Ellerman <michael at ellerman.id.au> wrote:
>> On Tue, 15 Nov 2005 19:34, Matthieu Moy wrote:
>>> John A Meinel <john at arbash-meinel.com> writes:
>>>> $archive/
>>>> .storage/
>>> I hate hidden files. They're not matched by * in my shell, so some
>>> commands like "rm foo/bar/*" or "mv foo/bar/* other/dir/",
>>> "du -sh *" ... fail.
>> I realise we've decided that .bzr should become _,+=HERE_BE_DRAGONS=+,_, but I
>> thought I'd just mention another reason why I like . files.
>>
>> They're not matched by * in my shell.
>
> Under zsh with 'setopt extended_glob' you can say
>
> du -sh *(D)
>
> the (D) turns on GLOB_DOTS, meaning that . at the start of a filename is
> not treated specially for globbing. zsh is highly worth learning.
>
Since you are mentioning zsh, I thought I might mention a different
shell, ipython.
http://ipython.scipy.org/
Basically it is an advanced interactive python interpreter. It isn't
designed to be a shell killer as such. Though it does mean you are
working in a fancy python shell. So you have access to a real language,
rather than shell.
Probably it would work more in conjunction with zsh, rather than as a
replacement. But whenever I want to do anything more advanced than just
basic interaction, I really would prefer writing in python, rather than
trying to figure out how to do it in shell.
For example, I want to rename all of the files that start with test_ or
test to remove the prefix, and I want to spawn "bzr mv" for each one,
not just "rename". I know there is some sort of pattern match operator
in bash (and I'm sure zsh) which involves {}, and ## or %% or //, or
whatever depending on what you want to match.
Or I can do it in ipython with:
alias bzr bzr %l
for f in os.listdir('.'):
if not (f.startswith('test') and f.endswith('.py')):
continue
if f.startswith('test_'):
g = f[5:]
else:
g = f[4:]
bzr mv f g
Now, it might be just as easy to do some sort of "for f in test*.py; do
bzr mv $f ${something}f; done"
But I always have to look up the ${something}, and it is easier for me
to just switch into python. Not necessarily shorter, but takes less
thought process for me (and less doc searching).
John
=:->
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 249 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20051118/5fb2268c/attachment.pgp
More information about the bazaar
mailing list