85,590 reputation
1092203
bio website
location European Union
age
visits member for 2 years
seen 3 hours ago

14h
comment Does -o and -i make sense when the target host is already connected to the interface specified?
If your eth1 goes down, you don't want those packets to go via the default route. It's better to be as restrictive as possible for ACCEPT rules. Here you only want those packets emitted on that interface.
1d
comment Count the maximum character length for all the data fields in a csv file and output to txt
regarding empty columns, yes, sorry, I had overlooked the fact that accessing max[i] instantiates the array element. Note that length(max) will give you max_NF in GNU awk (but GNU awk only).
2d
comment Why does my shell script choke on whitespace or other special characters?
-1 downvoting as it's confusing things more than helping.
2d
comment Why does my shell script choke on whitespace or other special characters?
@mikeserv, no it's unfortunate, it doesn't make sense, but that's what POSIX requires. It's been discussed before on the austin-group mailing list. IIRC some have also asked it be changed there. AT&T ksh, ash, dash, bash, yash all do the splitting. The only exceptions are pdksh/mksh (also posh maybe not for long) and zsh (even with sh_word_split). What you're quoting is about the things that are inside the $((...)), not its expansion itself.
Sep
12
comment How to assign space-containing values to variables in bash using eval
@mikeserv, what I'm saying is that if varname is meant to contain a variable name and varvalue is meant to contain a variable value (so any string), then $varvalue may contain a ;, but $varname may not. If you don't have control over the content of $varname (but I can't think of a context where that makes sense) and you want to avoid it having nasty side effects, then you need to sanitize it anyway whether you use eval or declare.
Sep
12
comment How to assign space-containing values to variables in bash using eval
; is not allowed in variable names. If you don't have control over the content of $name, then you need to sanitize it for export/declare as well. While export doesn't execute code, setting some variables like PATH, PS4 and many of those at info -f bash -n 'Bash Variables' have equally dangerous side effects.
Sep
12
comment How to assign space-containing values to variables in bash using eval
@mikeserv, then it's not a variable name. If you can't trust its content, then you need to sanitize it with both eval and declare (think of PATH, TMOUT, PS4, SECONDS...).
Sep
12
comment How to assign space-containing values to variables in bash using eval
@Patrick, seen the smiley? Having said that, using portable syntax means less effort when you need to port your code to another system where bash is not available (or when you realise you need a better/faster shell). The eval syntax works in all Bourne-like shells and is POSIX so all systems will have a sh where that works. (that also means my answer applies to all shells, and sooner or later, as happens often here, you'll see a non-bash specific question closed as a duplicate of this one.
Sep
11
comment How to assign space-containing values to variables in bash using eval
Using eval that way is wrong. You're expanding $var_value before passing it to eval which means it's going to be interpreted as shell code! (try for instance with var_value="';:(){ :|:&};:'")
Sep
11
comment Do files change while passing from ext2 to ext3 to ext4?
mv will try and preserve whatever is preservable including mtime and atime. It may not be able to preserve ownership or special file attributes. Some implementations will also try to preserve sparseness.
Sep
11
comment Do files change while passing from ext2 to ext3 to ext4?
move how?​​​​
Sep
11
comment How to stop bash editing the history when I reuse and modify an entry?
Since you can reproduce it, can you include the procedure you used (including the CTRL-C and the bash version) to reproduce it in your question. At the moment, I cannot reproduce it, though I know I've been annoyed by things like that with bash in the past.
Sep
11
comment Characters are encoded twice when I ask SSH to reattach a screen session on the remote host
You need to tell the screen that you're going to attach to the session that your locale is UTF-8. ssh -t remotehost LANG=fi_FI.UTF-8 screen -dt
Sep
10
comment Why does cat x >> x loop?
It does loop for me. Have you tried running it under strace/truss? What system are you on?
Sep
10
comment How do I recursively delete directories with wildcard?
-delete is not POSIX either. ** was introduced by zsh in the early 90s. It's now (by chronological order of appearance) also in ksh93, fish, bash and tcsh.
Sep
10
comment What does “LC_ALL=C” do?
Yes, I understand the author can do whatever he likes including not do what it says on the tin. The thing is. US English is the only language that can be represented correctly with the charset in LC_ALL=C, the only language where the sorting order in LC_ALL=C (LC_COLLATE) makes sense, LC_ALL=C (LC_TIME) has English month and day names. I've never seen apps where LC_ALL=C returned message in a different language from LC_ALL=en LANGUAGE=en. So am I entitled to report a bug against a program if that's not the case? (not talking about apps not translated to English here).
Sep
10
comment What does “LC_ALL=C” do?
You mean for gettext/LC_MESSAGES? But then if they are localised then their "strings" should be in English, right? Trying to see if there's any standard requiring it.
Sep
10
comment What does “LC_ALL=C” do?
What do you mean by default language?
Sep
10
comment Simple telephone system to record kids' “calls”
@bmauter. Yes, asterisk or freepbx will work with SIP phones. You could do tests with a software SIP phone first (jitsi/linphone...) before making any purchase. For asterisk/freebpx, you could try one of the many asterisk based distributions with a user-friendly web ui in a VM as setting up asterisk/freepbx can be a bit daunting otherwise for beginners.
Sep
10
comment Open a text file and let it update itself
most also has a tail -f mode with F.