96,039 reputation
12113238
bio website
location European Union
age
visits member for 2 years, 3 months
seen 9 mins ago

4m
comment How can I conditionally pass a subshell through 'time'?
eval joins its args before executing which is what you are trying to do in a very convoluted way. I meant that _time 'local var=1; blah' would make that var local to that _time, or that _time 'echo "$#"' would print the $# of that _time function, not that of the caller.
10m
awarded  Enlightened
12m
comment Dump network traffic of single application (strace-like)
Create a new network namespace for the application and capture all traffic in there may be an acceptable approach for some use cases as well.
15m
comment Dump network traffic of single application (strace-like)
They're are more likely hijacking the API (with LD_PRELOAD) than the packets. Having said that, one might be able to inject some setsockopt(SO_MARK) into applications and use netfilter to log the packets to ulog.
26m
comment Dump network traffic of single application (strace-like)
The problem is that applications don't send packets (except those using raw sockets like ping) but use a networking API that causes the kernel to send packets (and receive related one) on their behalf.
40m
answered Disable user shell for security reasons
2h
awarded  Nice Answer
5h
comment pkill -P $ID working while kill — -$ID not
shells use process groups for jobs only when interactive. With kill -- "-$PGID", it's the process group id you pass (that typically corresponds to the pid of the process that started the process group), not any random pid.
5h
comment sed: delete all occurrences of a string except the first one
That will only work with GNU sed.
14h
revised How to ensure that string interpolated into `sed` substitution escapes all metachars
added 5 characters in body
14h
comment Take the unknown contents of variable as literal in sed
@Gilles, that other question had the variable on the RHS. When it's on the LHS, it's quite different (I'd expect there be a question covering that already as well though)
16h
comment How do I expect 'echo -e “? \c”'?
? is a wildcard that matches any character, so yes, you need -ex, or expect "\\?" or expect {\?}
18h
comment How can I conditionally pass a subshell through 'time'?
@cuonglm, see info -f bash --index-search=time
23h
answered How can I conditionally pass a subshell through 'time'?
1d
comment Help with Grep , uniq and sort
What part do you not understand after reading the manual of those 3 commands?
1d
revised Help with Grep , uniq and sort
added 8 characters in body
1d
revised How to set an optional parameter?
removed the "opinion" part of it.
1d
comment Problem with passing parameters containing spaces and wild card characters
Similar: unix.stackexchange.com/q/119689
1d
answered Problem with passing parameters containing spaces and wild card characters
1d
comment Expansion of a shell variable and effect of glob and split on it
Note that it's called p̲a̲r̲a̲m̲e̲t̲e̲r̲ expansion because it applies to variables ($var) and other types of parameters like $1, $#, $?, $-...