1,684 reputation
312
bio website mpi-inf.mpg.de/~uwe
location
age
visits member for 1 year, 10 months
seen 14 hours ago

Apr
23
awarded  Good Answer
Feb
25
revised Quoting and escaping
added 314 characters in body
Feb
25
answered Quoting and escaping
Feb
22
comment Read non-bash variables from a file into bash script
It also handles comments incorrectly (the leading quote is kept, the trailing quote is deleted together with the #). BTW, it's probably useful to delete the comment together with any preceding whitespace.
Nov
14
comment Multi statement if condition in bash
No, it's not. When bash finds a command in backquotes, it executes the command, replaces it by its standard output, and continues execution. For instance, if you put echo ls in backquotes, then the echo command yields the output ls, and the ls command is then executed. In your example, bash executes the tar command, takes its standard output (i.e., a list of file names), and interprets that as a command to execute - but in general, that's not a reasonable command to execute. You could assign it to a variable, i.e., var=`tar ...` , but omitting the backquotes makes more sense.
Nov
13
comment Multi statement if condition in bash
The backqotes in your last version don't make sense. With the backquotes, you would take the standard output of tar ...; execute it, and then consider the exit status of that execution. You don't want that.
Nov
13
comment Multi statement if condition in bash
Works for me, even if I put it into a shell function. Could you show the entire part of the script that fails?
Nov
13
revised Multi statement if condition in bash
added 193 characters in body
Nov
13
comment Multi statement if condition in bash
That doesn't work (for several reasons: tar ... is not a conditional expression, and the logic is wrong).
Nov
13
answered Multi statement if condition in bash
Nov
10
revised how to emulate “replace a b b a” with a sed?
added 238 characters in body
Nov
10
answered how to emulate “replace a b b a” with a sed?
Nov
2
answered Maximize xterm via bash script
Sep
28
awarded  Yearling
Sep
11
comment Using sed to insert latex commands around headers of a document
Yes, exactly. \1,...,\9 refer to the string that is matched by the 1st,...,9th parenthesized subexpression; & refers to the entire string that is matched.
Sep
11
comment Using sed to insert latex commands around headers of a document
If you use & (= everything that's matched) in the replacement part, you can omit \( and \) in the pattern. The grouping parentheses are only necessary if you want to refer to a substring using \1,...,\9 in the replacement part.
Aug
27
answered Scope of variables when calling function from find
Aug
21
awarded  Nice Answer
Aug
21
comment Where does backtick and single quote come from when denoting commands e.g. `prog'?
see Why do Unix man pages use double backticks in place of double quotes?
Aug
21
answered Is it possible to create sticky redirection from stdout/stderr