Skip to main content
Added /, removed unneded quotes
Source Link
Ralf
  • 527
  • 2
  • 10

I'm not sure I fully understand the question and the context. But maybe this works:

#!/bin/bash
foo="$(realpath "...")"
bar="$(realpath "...")"

if [[ $foo = $bar/* || $bar = $foo/* ]]; then
    echo "Overlap"
fi
foo="$(realpath "...")"
bar="$(realpath "...")"

if [[ $foo = $bar/* || $bar = $foo/* ]]; then
    echo "Overlap"
fi

Note that this won't work if one tree is sym-linked into the other.

I'm not sure I fully understand the question and the context. But maybe this works:

#!/bin/bash
foo="$(realpath "...")"
bar="$(realpath "...")"

if [[ $foo = $bar/* || $bar = $foo/* ]]; then
    echo "Overlap"
fi

Note that this won't work if one tree is sym-linked into the other.

I'm not sure I fully understand the question and the context. But maybe this works:

foo="$(realpath "...")"
bar="$(realpath "...")"

if [[ $foo = $bar/* || $bar = $foo/* ]]; then
    echo "Overlap"
fi

Note that this won't work if one tree is sym-linked into the other.

Added /, removed unneded quotes
Source Link
Ralf
  • 527
  • 2
  • 10

I'm not sure I fully understand the question and the context. But maybe this works:

#!/bin/bash
foo="$(realpath "...")"
bar="$(realpath "...")"

if [[ "$foo"$foo = "$bar"*$bar/* || "$bar"$bar = "$foo"*$foo/* ]]; then
    echo "Overlap"
fi

Note that this won't work if one tree is sym-linked into the other.

I'm not sure I fully understand the question and the context. But maybe this works:

foo="$(realpath "...")"
bar="$(realpath "...")"

if [[ "$foo" = "$bar"* || "$bar" = "$foo"* ]]; then
    echo "Overlap"
fi

Note that this won't work if one tree is sym-linked into the other.

I'm not sure I fully understand the question and the context. But maybe this works:

#!/bin/bash
foo="$(realpath "...")"
bar="$(realpath "...")"

if [[ $foo = $bar/* || $bar = $foo/* ]]; then
    echo "Overlap"
fi

Note that this won't work if one tree is sym-linked into the other.

foo & bar are results if realpath
Source Link
Ralf
  • 527
  • 2
  • 10

I'm not sure I fully understand the question and the context. But maybe this works:

rd1="$foo="$(realpath "$foo""...")"
rd2="$bar="$(realpath "$bar""...")"

if [[ "$rd1""$foo" = "$rd2"*"$bar"* || "$rd2""$bar" = "$rd1"*"$foo"* ]]; then
    echo "Overlap"
fi

Note that this won't work if one tree is sym-linked into the other.

I'm not sure I fully understand the question and the context. But maybe this works:

rd1="$(realpath "$foo")"
rd2="$(realpath "$bar")"

if [[ "$rd1" = "$rd2"* || "$rd2" = "$rd1"* ]]; then
    echo "Overlap"
fi

Note that this won't work if one tree is sym-linked into the other.

I'm not sure I fully understand the question and the context. But maybe this works:

foo="$(realpath "...")"
bar="$(realpath "...")"

if [[ "$foo" = "$bar"* || "$bar" = "$foo"* ]]; then
    echo "Overlap"
fi

Note that this won't work if one tree is sym-linked into the other.

Source Link
Ralf
  • 527
  • 2
  • 10
Loading