File tree Expand file tree Collapse file tree 2 files changed +4
-3
lines changed
Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Original file line number Diff line number Diff line change 1- # -*- coding: utf-8 -*-
21#!/usr/bin/env python
2+ # -*- coding: utf-8 -*-
33
44# top.py -- top command implemented use python.
55# get infomation from /proc system.
Original file line number Diff line number Diff line change 88import sys
99import os
1010import os .path
11- import stat
11+
1212
1313def usage ():
1414 sys .stderr .write ("Usage: python which.py name\n " )
1515 sys .stderr .write ("or: which.py name\n " )
1616
17+
1718def which (name ):
1819 found = 0
1920 for path in os .getenv ("PATH" ).split (os .path .pathsep ):
@@ -30,6 +31,7 @@ def which(name):
3031 # Programming shortcut to toggle the value of found: 1 => 0, 0 => 1.
3132 sys .exit (1 - found )
3233
34+
3335def main ():
3436 if len (sys .argv ) != 2 :
3537 usage ()
@@ -38,4 +40,3 @@ def main():
3840
3941if "__main__" == __name__ :
4042 main ()
41-
You can’t perform that action at this time.
0 commit comments