Skip to content

Instantly share code, notes, and snippets.

@Trucido
Created April 8, 2018 20:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Trucido/7c4da232569bf111adf90e18982e4ead to your computer and use it in GitHub Desktop.
Save Trucido/7c4da232569bf111adf90e18982e4ead to your computer and use it in GitHub Desktop.
uniquefy_buttpaths
uniquefy_search_path ()
{
OIFS="$IFS"
IFS='
'
set -- $(echo ${1+"$@"} | sed -r 's@/*:|([^\\]):@\1\n@g;H;x;s@/\n@\n@')
IFS="$OIFS"
_y=""
for _x ; do
case ":${_y}:" in
*:"${_x}":*) continue
esac
_y=${_y:+"$_y:"}${_x}
done
echo "${_y}"
unset _y _x
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment