Artificial intelligent assistant

Adding directory path to a log file name Am writing script using bash. I have a name for a log file `log` and want to prepend a directory path `$destin`. But `$destin` can either end with `/` or without `/`. log="$destin/$log"

There's variable expansions that do exactly that:


log="${destin%/}/$log"


The `%` removes the suffix that follows from the variable, if present.

However, this isn't ncecessary: `path//file" and "path/file" are the same file.

As Quasimodo points out:

If removing any number of slashes is really needed, `log="$(dirname "$destin")/$(basename "$destin")"` should do. This will also work if `destin` is something like `a/b/c///`.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 04e4ee291ef514240b938191e6754c01