forked from bmajoros/python
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest-pipe.py
executable file
·29 lines (24 loc) · 939 Bytes
/
test-pipe.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env python
#=========================================================================
# This is OPEN SOURCE SOFTWARE governed by the Gnu General Public
# License (GPL) version 3, as described at www.opensource.org.
# Copyright (C)2016 William H. Majoros ([email protected]).
#=========================================================================
from .Pipe import Pipe
#import subprocess
#import sys
#def run_command(command):
# command=command.split()
# p = subprocess.Popen(command,
# stdout=subprocess.PIPE,
# stderr=subprocess.STDOUT)
# return iter(p.stdout.readline, b'')
#for line in run_command("ls -la"):
# line=line.decode(sys.stdout.encoding).rstrip()
# #line=line.decode("utf-8").rstrip()
# print("line=",line)
pipe=Pipe("ls -la | sort -g | sort -r | uniq -c")
while(True):
line=pipe.readline()
if(not line): break
print(line)