File: findinpath

package info (click to toggle)
tcltrf 2.1.4-dfsg3-1
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 9,628 kB
  • sloc: ansic: 73,134; sh: 3,155; tcl: 1,343; makefile: 176; exp: 22
file content (20 lines) | stat: -rwxr-xr-x 349 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/local/bin/tclsh
# -*- tcl -*-
# needs no '#!' path
# find an application via PATH, like 'which'

set app  [lindex $argv 0]
set path [split $env(PATH) :]

foreach p $path {
    set papp [file join $p $app]

    if {[file exists $papp]} {
	puts $papp
	exit 0
    }
}

# not found -- no error, fixhbline will check for empty name
#exit 1
exit 0