Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

7
  • If I understand the original question correct, $foo and $bar should already be results from realpath, so you could use $foo and $bar directly instead of $rd1 and $rd2 Commented Jan 8, 2019 at 10:05
  • @Bodo You are right, updated. Commented Jan 8, 2019 at 10:14
  • Excellent! I didn't know that idiom. I think I need a / before the *, right? Also, man bash says there is no word splitting inside [[ ]], could I drop the double quotes there? Commented Jan 8, 2019 at 16:35
  • Good catch! Yes, the / is needed. The quotes are not needed. I always follow: if in doubt: quote. I'll update. Commented Jan 8, 2019 at 16:45
  • @Ralf thanks! I follow the same rule, but in an answer I think it's better to be as accurate as possible. I also did some tests about the quotes in foo="$(...)". The man is not very explicit about word splitting of the result of $(); I understand this result may be split according to the context, hence there is no word splitting here because variable assignments do not induce word splitting. Thanks again! Commented Jan 8, 2019 at 19:22