507 reputation
521
bio website
location
age
visits member for 2 years, 3 months
seen 7 hours ago

Shyy erny anzr - Naqernf Rvonpu


Dec
16
comment Create a binary input file from hdparm's --read-sector option
Well, this is just what I wasn't sure about two weeks ago.
Dec
16
comment Create a binary input file from hdparm's --read-sector option
Well, the most important thing to me was, that in the hdparm manual (I read it thoroughly several times), there was something explained about hdparm using an extremely low-level approach to read sectors when using --read-sector. So frankly, I wasn't sure (or better: much too skeptical) about whether ddrescue would use a likewise low-level approach or one or more tiers higher. Needless to say that the lowest tier was just good enough to get something useable out of those few corrupt sectors.
Dec
15
comment Flash plugin up to date but Firefox keeps telling me that I have the old version
"Simple script"? I beg to differ. :P I think that for f in $(ps -C firefox -o user=); do will work perfectly enough :) Moreover, when I use your line, I find out that first line is the grep itself, and the firefox line I want is in line #2. So if you do want to go the complicated way, make sure you insert a | grep -v grep somewhere as well.
Dec
15
comment Read-only file system error while accessing the files on Ubuntu
This question is impossible to answer sensibly without knowing what file system it is about you're trying to create your testFolder on. Consider that also NTFS partitions can be accessed from a Linux-type system...
Dec
15
comment awk separate columns of 3
@Arcege nit: $ awk -f whatever.awk is not necessary if the shebang #! has already specified /bin/awk -f. In your case, $ ./splitnum.awk filename will work a treat. The gain is: less typing effort.
Dec
15
comment Calculate and divide by total with AWK
Thanks, very interesting stuff. But do not even think of using this in C! As awk's printf syntax is pretty alike to the C syntax, this looks sooo darn tempting. But C, in contrary, will show itself obdurate here once more (just had to test it! :)) warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘int’. Trying to run that program even resulted in a segfault...!---So what this post is supposed to say is: don't assume that what you can do in awk would be possible in C as well. awk is WAY more liberal in that respect.
Dec
15
comment Calculate and divide by total with AWK
BTW you need not run it as cat data | ./totals.awk. Consider that awk WANTS a file, so just do a ./totals.awk data (or if you insist, totals.awk < data, in this case it should not matter) instead. Anyways, the gist is: in any case, omit that superfluous cat.
Dec
15
comment Calculate and divide by total with AWK
Yes, but chances are the latter will not be entirely POSIX-compliant then. (From the top of my head though, would have to try it out to be sure, perhaps I'm again confusing it with command substitution ;))
Dec
15
comment Calculate and divide by total with AWK
Just a +1 for not using cat. It always hurts my eyes to see cat "misused" like that. Poor cat! (meow) ;)
Dec
15
comment Proper escaping of double quotations for curl post data?
Just a wild guess, but I seem to remember that in curl the nested quoting works indeed the same way as in alias in bash. For instance, this is one of my many alias lines: alias hdd='lsblk -nio KNAME,MODEL,SIZE,MOUNTPOINT | grep -vi "\(1K\|sd[a-z][1-3]\s\+[0-9]\+,[0-9]G $\|swap\)"'. It's always a battle with these nested ones: one mistake, and you may search for 15 minutes where the "bug" is.
Dec
15
comment bash: What is the difference between these two script variants?
@PM2Ring Many thanks. There is nothing worse I can think of than bash's "error handler" whenever you mistype something (or "inject" something else from other programming languages because you mixed things up again). Those error messages are about as useful as those from several products made by the huge company with the capital M, and in 95% of cases, they will always lead you up the garden path.
Dec
15
comment Killing a shell script running in background
@light94 You are right. It happened frequently here that the jobs command really only displayed the running jobs while in the shell. Once I closed a certain terminal window, the only way to access them was via ps (see above for that). So it's for sure that you're not making this up.
Dec
15
comment Killing a shell script running in background
Bravo. To get some '$$' into the pun cash box again, I would like to emphasize that the -9 option would be total over-kill here. :P
Dec
15
comment bash: What is the difference between these two script variants?
Yes, that's what I was just trying to point out. In JS, the choice of quotes (single/double) does not change the meaning. But in bash, it will, with usually entirely different results in resolving variables (getting literal $var output instead of their value) etc...
Dec
15
comment bash: What is the difference between these two script variants?
Thanks for "abusing" (?) this answer! As said in my comments, it was a long-time false interpretation of yours truly of this quoting stuff. Well, of course I knew that in JavaScript (simple) nested quoting is achieved by using single quotes for the outer and double ones for the inner term. BUT I knew as well that with echo the use of single/double quotes had a totally different meaning (i. e. interpreting $... variables and other things (y/n)). So I assumed the bash way (e. g. echo) is to use double quotes twice. However, had I had a notion of how this is interpreted...oh well.
Dec
14
comment Reading and searching long man pages
@Gilles My fingers are really itching to simplify this, especially the pipe which looks like trying to do things completely butt-backwards (to use a US phrase) :)) Like getting the buzz saw from the basement just to cut a 1"-diameter round timber ;))
Dec
14
comment Reading and searching long man pages
I'm not putting this as an answer either ;) because it's indeed about bash itself: just like you, I too mostly need the SHELL BUILTINS part of the manual, which is at about line 3500. So knowing this, the next time I would just say man bash and then go down 66 percent, by typing 66%, then a few times PgDn and I'm there. Though I chose 66 because it can be memorized as "Route 66", it is actually a little more than that, albeit not so easy to memorize unless it is the beginning of your phone #, etc. :) At least the "Route 66" is universal and known worldwide.
Dec
14
comment find -exec in bash script with variable expansion
@user unknown Well, I do LOVE this code. It's at least fully POSIX-compliant and will work without any GNU stuff on the machine at all. There are those times when you do need this, especially on servers at work.
Dec
14
comment bash: What is the difference between these two script variants?
@glenn jackman Yes, this is what I've figured out. But it obviously did require me to "study" Hauke's post first to get me bumped head-first onto the truth...Again, I just could not determine what it stood for, whether it was quotes-inside-quotes or, as I know now, an unquoting technique, actively and deliberately excluding the stuff between the quote pairs. It was simply a wrong understanding of things...but the main reason was it always worked, i. e. no complaints from bash's side. And once it works, you commonly don't start asking about any further hows and whys. :)
Dec
14
comment bash: What is the difference between these two script variants?
Aha, and why didn't you tell that in the first place? Sheesh...You're feeling like a true maths guy, I even knew one personally...same thing.---But that aside, thanks for clearing things up once and for all. Still, it IS quoted. Unless someone really proves me wrong, you may nest quotes with echo that way. I begin to understand: you read it as first quote ending before $f and second (empty) quote starting after $f, which leaves the lone $f unquoted. I always thought that the way I wrote them, they're interpreted as nested. Would need a proof though to think otherwise.