Reputation
143,517
Next tag badge:
1001/1000 score
194/200 answers
Badges
21 202 381
Newest
 Good Answer
Impact
~7.2m people reached

Feb
2
comment ls | grep works doesn't work with ls --color
Note that rwx are not the only permissions, especially for directories where t and s are common (see /tmp for instance). Only files last modified between 6 months ago and now have their time displayed with HH:MM (in the C and most English locales at least).
Feb
2
comment ls | grep works doesn't work with ls --color
Presumably with his grep for HH:MM, the OP wanted only the files last modified between 6 months ago and now, for which you'd also need a -mtime -180 -mtime +0
Feb
2
comment DASH scripting errors: I don't think I know how to set up variables correctly
@cuonglm $((...)) is a POSIX thing (coming from ksh), it's not Bourne. Yes, like I said, $((x)) is POSIX as long as x contains a valid integer constant (decimal, octal or hexadecimal), but didn't work in dash prior to 0.5.5. $(($x)) is also POSIX and works in all shells. Watch out for things like $((-$x)) that don't work properly for negative values if $x in shells that support the -- operator.
Feb
2
revised DASH scripting errors: I don't think I know how to set up variables correctly
added 732 characters in body
Feb
1
comment Is there a way to modify a file in-place?
@AaronBlenkush, see edit.
Feb
1
revised Is there a way to modify a file in-place?
added 441 characters in body
Feb
1
awarded  Enlightened
Feb
1
awarded  Necromancer
Feb
1
answered DASH scripting errors: I don't think I know how to set up variables correctly
Feb
1
awarded  Nice Answer
Feb
1
comment DASH scripting errors: I don't think I know how to set up variables correctly
I'm not sure I understand your answer. (($REG+1)) is not standard sh syntax, and even in shells that have ((...)), that wouldn't make much sense. The arithmetic operators of the [ command only recognise decimal numbers, not hexadecimal (even in bash or ksh or zsh).
Feb
1
comment DASH scripting errors: I don't think I know how to set up variables correctly
There's not shell where REG=((REG+1)) works. ITYM ((REG = REG + 1)) (or ((REG++)) in those shells that have that non-standard ((...)) construct).
Feb
1
comment DASH scripting errors: I don't think I know how to set up variables correctly
REG=$(($((REG))+1)) is not different from REG=$((REG + 1)). If you need to support very old versions of dash, it's REG=$(($REG + 1)) you need.
Feb
1
comment DASH scripting errors: I don't think I know how to set up variables correctly
@cuonglm, x=$((x+1)), : "$((x+=1))", x=$(($((x))+1)), x=$(($x+1)) are all POSIX as long as $x contains a valid integer constant (decimal, octal or hexa), but some old versions of dash only supported the latter as earlier versions of the POSIX spec were unclear about it (still not very clear but a bit better), : "$((x++))" is not POSIX though allowed (as in $((x++-1)) can be either $(((x++) - 1)) or $((x + +(-1)))
Feb
1
awarded  Nice Answer
Feb
1
revised shell script to make directories, subdirectories and files following a pattern
drop bash tag since the accepted solution uses zsh.
Feb
1
revised shell script to make directories, subdirectories and files following a pattern
added 139 characters in body
Feb
1
revised shell script to make directories, subdirectories and files following a pattern
added 100 characters in body
Feb
1
revised Is it possible to save Linux virtual console content and scrollback in a file?
added 65 characters in body
Feb
1
answered shell script to make directories, subdirectories and files following a pattern