You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I needed that at some point and ended up not using it, but it could be useful in bashkit
it can be made to work with all strings by removing all lines with a '/' in them
longest_common_prefix() {
__="$1"
shift 1
if (( $# == 0 )); then return; fi
local i=0
while (( $# > 0 )); do
for ((i=0; i<${#__}; i++)); do
if [[ "${__:i:1}" != "${1:i:1}" ]]; then
__=${__:0:i}
fi
done
if [[ "${1:i:1}" == "/" ]]; then
__="${__}/" # common path in arg list
fi
shift 1
done
__=${__%/*} # cut to the last /
}
I needed that at some point and ended up not using it, but it could be useful in bashkit
it can be made to work with all strings by removing all lines with a '/' in them
https://stackoverflow.com/a/77175913/2838914
The text was updated successfully, but these errors were encountered: