1#!/usr/local/bin/tclsh 2# -*- tcl -*- 3# needs no '#!' path 4# find an application via PATH, like 'which' 5 6set app [lindex $argv 0] 7set path [split $env(PATH) :] 8 9foreach p $path { 10 set papp [file join $p $app] 11 12 if {[file exists $papp]} { 13 puts $papp 14 exit 0 15 } 16} 17 18# not found -- no error, fixhbline will check for empty name 19#exit 1 20exit 0 21