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.

5
  • that is better for indente, can you explain IFS meen Commented Mar 19, 2021 at 0:05
  • 1
    The "$*" and "${array[*]}" forms, when in double quotes, join all the elements into a single string, joined by the first character of the IFS variable. IFS is, by default, "space tab newline", so I redefine it in the subshell to hold the directory separator. Commented Mar 19, 2021 at 15:18
  • wow, i see some Magic here, it's perfect Mr @glenn-jackman Commented Mar 21, 2021 at 1:38
  • donc ,you are using IFS to trim whitespace ? and converte to "/" Commented Mar 21, 2021 at 1:41
  • 1
    The array contains 5 elements with no extra whitespace. You can inspect the array using declare -p path. "${path[*]}" joins the elements into a single string using /, the first character of IFS. Commented Mar 21, 2021 at 12:03