77,127 reputation
1082181
bio website
location European Union
age
visits member for 1 year, 11 months
seen 4 hours ago

4h
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
10h
comment Reverse grepping
@RedGrittyBrick, do you have any reference for that, or could you please tell which systems have that limitation?
11h
revised reset for loop counter
added 64 characters in body
11h
answered reset for loop counter
11h
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.
11h
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?
11h
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.
12h
comment Reverse grepping
tac is the GNU command. On most other systems, the equivalent is tail -r.
13h
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?
14h
comment How to compare to floating point number in a shell script
Note that it says that 1.00000000000000000000000001 is greater than 2.
14h
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.
14h
revised How to iterate through multiple file extension without caring about case sensitivity?
added 54 characters in body
14h
answered How to iterate through a list of files with spaces that is sorted (case insensitive)?
14h
revised How to iterate through a list of files with spaces that is sorted (case insensitive)?
added 21 characters in body
14h
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.
14h
comment How to set parameter zero ($0) while executing a script?
0=new-value in zsh or es. set 0 new-value in fish. zsh sets $0 to the name of the function in functions. Same in ksh when the function is declared with function f { ... }
14h
comment Grep display both matched and umatched lines
@Gnouc, interestingly grep --color -e x -e '^' segfaults in OS/X (FreeBSD grep 2.5.1) but not with $, so I've updated the answer once again for better portability.
14h
revised Grep display both matched and umatched lines
with `^`, it segfaults on OS/X
15h
revised Remove line containing certain string and the following line
added 47 characters in body
15h
comment Grep display both matched and umatched lines
@Gnouc, which version of grep is that? I've updated the answer.