280 reputation
18
bio website
location Austria
age
visits member for 2 years, 8 months
seen Dec 14 at 16:54

Dec
1
comment Rename files with even numbers
If you do a mv 1-001.png 1-002.png than 1-002.png will be overwritten by 1-001.png. You should be aware of that. On way to overcome this is to start with the highest number.
Dec
1
comment How to use printf to show the results of a calculation?
There is no need for the unreadable printf '%s * %s\n' "$salary" "0.15" . One can use echo "0.15 * $salary". the "-quotes suppress the filename globbing but allows the evaluation of variables.
Dec
1
comment How to replace this value in bash/sed
Your answer contains 10 lines. 9 of them are of no interest to the reader. Maybe it is better to remove them and add some explanation that helps to understand the regular expression. Your prompt is not chosen very well for a code sample: the blank between the path and the trailing '>' makes me believe that the '>' is part of the command. Also the information moi@laptop:/home/moi/tmp is not really valuable.
Dec
1
comment Sed: how to replace nextline \n symbol in text files?
It is true that \nseparates a line from the nextline but it is commonly known as newline character
Nov
26
comment Change Text File Encoding without knowning the source encoding
Why do you need this?
Sep
24
comment How to remove all comments from a file?
you cannot remove parts of a line with grep. you can use sed for this
Aug
15
comment Identifier must be declared
you can try to shorten your program but in such a way that the error still will be raised. So you can narrow down the statement where the error occurs.
Aug
15
comment Identifier must be declared
what shell are you using?
Jun
17
awarded  Caucus
May
6
comment How to sed -e 's///' everything except a specific pattern?
does each line contain only one % sign?
May
6
comment Detecting extension files doesn't executed for a period
you suggest to use the option "newer" but actually you use "newerat"
Apr
30
revised Remove last comma from a bash for loop generated string
minor changes
Apr
30
answered Remove last comma from a bash for loop generated string
Apr
4
comment What does $# mean in shell?
you can browse the manual
Apr
2
comment A bash function that takes argument like other languages?
@mikeserv: For what value of V the function assign PATH "$V" executes some malicious code?
Apr
2
comment A bash function that takes argument like other languages?
@mikeserv: It is interesting when one wants to use your variable v (better its value) as second argument of the assign function. So its value should be on the right hand side of an assignement. It is necessaary to quote the argument of the function assign. I added this subtlety to my posting.
Apr
2
comment A bash function that takes argument like other languages?
@mikeserv: I think that your proposal to transform the first argument silently to a valid variable name is not a good idea: 1) some variable is set/overwritten that was not intended by the user. 2) the error is hidden from the user of the function. That is never a good idea. One should simply raise an error if that happens.
Apr
2
comment A bash function that takes argument like other languages?
@mikeserv thank you for your comment but I think that is not a valid example. The first argument of the assign script should be a variable name or a variable that contains a variable name that is used on the left hand side of the = assignement statement. You can argue that my scrip does not check its argument. That is true. I do not even check if there is any argument or if the number of arguments is valid. But this was by intention. The OP can add such checks if he wants.
Apr
2
revised A bash function that takes argument like other languages?
and additional sample quere quoting must be considered
Apr
2
revised A bash function that takes argument like other languages?
link to description of eval