Fri, 24 Jul 2009 21:17:26 +0200: Kamil Dudka <address@hidden> wrote:
> We can do the same with:
>
> $ readlink -f "$path0/$path1"
I just tried "readlink -f a/b" and it prints nothing if the directory
"a" doesn't exist in the current directly.
> The algebra seems really strange to me. Has the '-' operator usual semantic
> of unary '-' (meaning inverse element with regards to binary operation '+')?
> Then should the following be always true:
> 1. -(-a) == a
> 2. a - b == a + (-b)
They are true.
> Do we have any real life use-case for the operator '-'? I think concatenation
> with "/.." and/or sed invocation are mostly sufficient.
>
> > 3. Form a list of path with binary operator ' '.
> >
> > <path0> <path1>
> >
> > This form a list of two paths.
>
> $ printf "%s %s\n" `readlink -fn $path1` `readlink -fn $path2`
>
> > 4. Distribute concatenation and elimination operation onto a list of
> > paths with a binary operator *.
> >
> > <path0> * ( <path1> <path2> )
> >
> > is equivalent to
> >
> > <path0> + <path1> <path0> + <path2>
> >
> > ( <path0> <path1> ) * - <path2>
> >
> > is equivalent to
> >
> > <path0> - <path2> <path1> - <path2>
>
> We can do this by running the above mentioned in a loop (using shell).
I fully agree with you that all these are doable with existing
commands and scripting. What I am proposing is a dedicated command
for path manipulation with concise expression.
-Tak