How can I convert a string containing glob characters such as
/var/lib/gems/*/bin
into a colon-separated string of filenames (i.e. PATH com
printf "%s\n" /var/lib/gems/*/bin | tr "\n" ":"
It's pretty trivial if you drop into Perl:
perl -e 'print join ":", @ARGV' /var/lib/gems/*/bin
Or Python:
python -c 'import sys; print ":".join(sys.argv[1:])' /var/lib/gems/*/bin
Or any number of other popular scripting languages.