78,066 reputation
1082186
bio website
location European Union
age
visits member for 1 year, 11 months
seen 7 hours ago

Jul
24
comment Find the exact string with grep
That also matches user1@example-com.
Jul
24
answered Find the exact string with grep
Jul
24
comment Does “mount -o remount,ro” flush filesystem buffers?
Yes, unless the remount is combined with a bind.
Jul
24
comment Find all occurances in a file with sed
Yes, on Linux, you can test a different implementation with the sed from the heirloom toolchest which is a descendant of the traditional Unix sed. The POSIX/Unix spec for sed is at pubs.opengroup.org/onlinepubs/9699919799/utilities/sed.html
Jul
24
answered how do I recursivley grep (or otherwise search for) hex strings
Jul
24
comment Process history in Unix/Linux systems
On *nix, that's rather be ps -efl. ps aux for BSD/Linux only.
Jul
24
revised monitoring events (keyboard, mouse) in X
deleted 41 characters in body
Jul
24
comment Why is `tac file | grep foo' (piping) faster than `grep foo < <(tac file)' (process substitution)?
It's not only SysV (SysV generally referring to a reference implementation and also to a family of OSes) and Linux. Solaris, all modern BSDs and probably many others support /dev/fd/n. (actually, the Linux one is significantly different from that of others as it's implemented as symlinks to original resources while in other Unices /dev/fd/n are special devices which when open, work like dup (which is why I said on Linux, and Linux only, /dev/fd/n on a pipe acts as a named pipe)).
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.