(Nov-02-2016, 03:33 PM)micseydel Wrote: Could you elaborate on the benefit(s) of this?
i, personally, scan for files a lot with pipelines to work with very large lists (i currently have around 6000000 files in the /home directories. filtering specific file types makes for faster content searches and gives me less noise.
for many people, there may be no benefit at all.
(Nov-02-2016, 06:17 PM)Ofnuts Wrote: Also curious... and why not an alias anyway.
it could have been an alias. but i have many times run into cases where filtering file paths like this is not running under a shell, or initializing the shell to have all my aliases (there would be many if i did this as aliases or shell functions) is not always practical. i have done many of these as shell scripts and they are under my working plans to convert most shell scripts to python3. when i write new scripts, now, i try to do them in python3 first, falling back to python2, pike, awk, bash and C (in that order) if there are problems (had one, once, but re-did it in python3 later). simple aliase-like commands like this are trivial and have never had problems.
i just rewrote it to take symlinks for many languages/extension:
#!/usr/bin/env python3
from os import execvp
from sys import argv
execvp('egrep',['egrep','\.'+argv[0].split('/')[-1].split('grep')[0]+'$']+argv[1:])
then i did:
ln -fsv grepext /usr/local/bin/pygrep
and some others. symlinks still take filesystem space and cache memory so there is still no real gain.