77,711 reputation
1082185
bio website
location European Union
age
visits member for 1 year, 11 months
seen yesterday

Jul
24
comment Why is `tac file | grep foo' (piping) faster than `grep foo < <(tac file)' (process substitution)?
Well, wikipedia is wrong here (and bash-centric). Simply run ls -l <(:) to verify that it doesn't use named pipes.
Jul
24
comment Why is `tac file | grep foo' (piping) faster than `grep foo < <(tac file)' (process substitution)?
Note that it's < <(...) short for 0< <(...), not <<(...).
Jul
24
comment Why is `tac file | grep foo' (piping) faster than `grep foo < <(tac file)' (process substitution)?
process substitution appeared on ksh and was using /dev/fd/n (a SysV feature) from the start (and was not available on systems that didn't support it). bash and zsh added support for named pipes for systems that lacked /dev/fd/n later.
Jul
24
comment Why is `tac file | grep foo' (piping) faster than `grep foo < <(tac file)' (process substitution)?
process substitution leverages /dev/fd/n, it doesn't use named pipes (though on Linux, and linux only /dev/fd/n behave like named pipes when n is a file descriptor to a pipe (named or not)). On systems that don't support /dev/fd/n, some shells fall back to using named pipes.
Jul
24
comment Find all occurances in a file with sed
-e is not GNU specific. To be POSIX/portable, you do need it as there can't be anything after } (and you need a ; before it).
Jul
23
comment Reverse grepping
@CristianCiupitu, as I said, GNU has tac (and only GNU has tac) many other Unices have tail -r. GNU tail doesn't support -r
Jul
23
comment Reverse grepping
@RedGrittyBrick, do you have any reference for that, or could you please tell which systems have that limitation?
Jul
23
revised reset for loop counter
added 64 characters in body
Jul
23
answered reset for loop counter
Jul
23
comment reset for loop counter
Other than the cosmetic replacement to (( list[j] == 2 )) && j=1 or (( list[j] == 2 && j = 1)), I don't think you'll get any much better.
Jul
23
comment reset for loop counter
If the list was (1 5 1 2 9), how would zsh know which 1 i=${list[1]} should bring you back to?
Jul
23
comment How to compare to floating point number in a shell script
Yes, but it's the locale of the script user, not the locale of the script author that matters. As a script author, you should take localisation and its side effects into account.
Jul
23
comment Reverse grepping
tac is the GNU command. On most other systems, the equivalent is tail -r.
Jul
23
comment How to find which application is creating a particular file in a path?
What variant of Unix? What's the output of uname -rs?
Jul
23
comment How to compare to floating point number in a shell script
Note that it says that 1.00000000000000000000000001 is greater than 2.
Jul
23
comment How to iterate through multiple file extension without caring about case sensitivity?
Note that -iname is not standard. You also need braces as -a has precedence over -o and so only .py files will be processed. Also note that find will include hidden files (and descend into hidden dirs) while **/ will not by default.
Jul
23
revised How to iterate through multiple file extension without caring about case sensitivity?
added 54 characters in body
Jul
23
answered How to iterate through a list of files with spaces that is sorted (case insensitive)?
Jul
23
revised How to iterate through a list of files with spaces that is sorted (case insensitive)?
added 21 characters in body
Jul
23
comment How to compare to floating point number in a shell script
Setting LC_NUMERIC won't work if the user has set LC_ALL, that also means that numbers will not be displayed (or input) in the user's preferred format. See unix.stackexchange.com/questions/87745/what-does-lc-all-c-do/… for a potentially better approach.