Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hblock via Cmder terminates on '| sort -u' #6

Closed
xmtrcv opened this issue Aug 18, 2016 · 0 comments
Closed

hblock via Cmder terminates on '| sort -u' #6

xmtrcv opened this issue Aug 18, 2016 · 0 comments

Comments

@xmtrcv
Copy link

xmtrcv commented Aug 18, 2016

hblock terminates at the "Sort entries" command using Cmder on Windows (10).

λ sh hblock -O "%SystemRoot%\System32\drivers\etc\hosts"
--- 8< ---
   - Sort entries
-uThe operation completed successfully.

Of course, nothing actually completed successfully. (See below for sort behavoir.)

On line 217, changing | sort -u to | sort | uniq allows hblock to actually complete successfully. :)

λ sh hblock -O "%SystemRoot%\System32\drivers\etc\hosts"
--- 8< ---
   - Sort entries
   - Add new destination
 + Generating hosts file...
 + 50218 hosts added!

Making the same edit on a Linux VM (CentOS-7.2.1511) showed identical write and sort behavior between | sort -u and | sort | uniq.

Comparing the output files of each with diff only shows a difference in commented time stamps.

xD

.
edit

Sort as provided by Cmder is a Windows command, hence the incompatibility.
https://technet.microsoft.com/en-us/library/bb491004.aspx

λ cat sortme
XX          
bb          
cc          
aa          
bb          
cc          
xX          
cc          
xx          

λ cat sortme | sort
aa                 
bb                 
bb                 
cc                 
cc                 
cc                 
xx                 
xX                 
XX                 

λ cat sortme | sort -u
-uThe operation completed successfully.
cat: write error: No space left on device

λ cat sortme | uniq
XX                 
bb                 
cc                 
aa                 
bb                 
cc                 
xX                 
cc                 
xx                 

λ cat sortme | sort | uniq
aa
bb
cc
xx
xX
XX

Just to show there is really space left on device :) sort in Cmder is being silly.

λ df -h | head -1 && df -h | tail -1
Filesystem                                               Size  Used Avail Use% Mounted on
N:/Users/Username/Downloads/cmder/vendor/git-for-windows  932G  294G  638G  32% /
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant