bug-coreutils
[Top][All Lists]
Advanced

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

bug#5926: feature request: mv -p to create missing target dir


From: Andreas Schwab
Subject: bug#5926: feature request: mv -p to create missing target dir
Date: Mon, 26 Apr 2010 11:00:24 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.96 (gnu/linux)

Stefano Lattarini <address@hidden> writes:

> Just a few obsevations on side issues...
>
> Bob Proulx writes:
>> Rodolfo Borges wrote:
>>
>> > cat <<EOF >> ~/.bashrc
>> > function mv() {
>> >     local target="${!#}"
>> >     local dir
>> >     if [[ "$target" =~ '/$' ]]; then
>> >         dir="$target"
>> >     else
>> >         dir="$(dirname "$target")"
>> >     fi
>> >     test -d "$dir" || mkdir -vp "$dir"
>> >     $(which mv) "$@"
>> > }
>> > EOF
>> 
>> Very good!  I see that you have a solution to your problem.
>> 
>> As a side comment I don't see the point of:
>> >     $(which mv) "$@"
> I think that's needed because otherwise the shell function would end 
> up calling itself recursively, since it's named `mv' too.

You use "command mv" for that.

Andreas.

-- 
Andreas Schwab, address@hidden
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."






reply via email to

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