#!/bin/sh # Next line is a comment to tcl/tk, but not to sh... \ exec tclsh $0 set n 0 foreach d [split $env(PATH) :] { if [file exists $d] { # File exists... is it in our list yet? if { [info exists havefile($d)] == 0 } { # Directory not previously seen if {$n} { puts -nonewline stdout ":" } puts -nonewline stdout $d set havefile($d) 1 incr n } } } puts stdout ""