[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gnu-arch-users] Convenience shell macros
From: |
Jan Hudec |
Subject: |
Re: [Gnu-arch-users] Convenience shell macros |
Date: |
Tue, 3 Feb 2004 10:11:36 +0100 |
User-agent: |
Mutt/1.5.5.1+cvs20040105i |
On Mon, Feb 02, 2004 at 12:48:29 +1100, Brian May wrote:
> >>>>> "Jan" == Jan Hudec <address@hidden> writes:
>
> Jan> Off the top of my head (not testing it):
> Jan> trd() {
> Jan> if [ -r "$1/.arch-ids/=id" ]; then
> Jan> ID=$(cat "$1/.arch-ids/=id")
> Jan> rm "$1/.arch-ids/=id" &&
> Jan> rmdir "$1/.arch-ids" &&
> Jan> rmdir "$1" ||
> Jan> tla add --id "$ID" "$1"
> Jan> else
> Jan> rmdir "$1"
> Jan> fi
> Jan> }
>
> Works great!
>
> Thanks.
>
> The only change I had to do was to insert "-f" in the rm command, as
> otherwise it will prompt me if I really want to remove the file (I
> have rm aliased to "rm -i").
You better quote the command then -- 'rm' -- so it still complains if
the file can't be deleted.
-------------------------------------------------------------------------------
Jan 'Bulb' Hudec
<address@hidden>