https://bugzilla.novell.com/show_bug.cgi?id=300678#c34
Dr. Werner Fink changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEEDINFO |ASSIGNED
Info Provider|werner@novell.com |
--- Comment #34 from Dr. Werner Fink 2007-10-16 08:02:18 MST ---
There is no way to use ${x//y/z/} in ash therefore I'd like to suggest to
use sed but only once:
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
}
uniquefy_search_path b:a:c:a
uniquefy_search_path a:b:a:c
uniquefy_search_path ' a: b: a:c:a '
uniquefy_search_path ' a: b: a:\:c:a :\:c'
uniquefy_search_path /b/:/a/:/c/:/a/
uniquefy_search_path /a/:/b/:/a/:/c/
uniquefy_search_path '/ a/:/ b/:/ a/:/c/:/a /'
uniquefy_search_path '/ a/x/:/ b/x/:/ a/x/:/\:c:/a /x/:/\:c'
uniquefy_search_path '/ a/x/:/ b/x/:/ a/x/:/\:c/x/:/a /x/:/\:c/x/'
uniquefy_search_path '/ a/x/:/ b/x/:/ a/x/:/\:/c/x/:/a /x/:/\:/c/x/'
note that the IFS is set this way because the ash also does not know
about $'\n' as ksh or bash do. The method
IFS='
'
only includes the newline, there is no space of tabulator included.
--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.