Reputation
213
Top tag
Next privilege 250 Rep.
View close votes
Badges
1 9
Newest
 Yearling
Impact
~3k people reached

Feb
6
comment Can't use !$ in script?
And it won't affect any other bash instance that runs your script.
Jan
9
comment Can I put ranges to parameters?
Why are you breaking out the regexes for integer comparisons?
Jan
3
comment How can I securely delete the contents of a thumb drive so data can't be recovered.
@Sobrique Overwriting as much as the disk will let you will make it significantly harder to recover data than simply formatting it, while taking about the same amount of effort (though it may take significantly more time). An attacker would have to bypass the controller and read the raw cells to try and pick out stuff that didn't get overwritten, rather than simply dumping the disk byte-for-byte and using what's left of the filesystem structures, or just searching the rest for things that look useful.
Jan
1
comment How can I securely delete the contents of a thumb drive so data can't be recovered.
If it's a cheap, replaceable flash drive, definitely go with physical destruction. If you do use a hammer, make sure you get the actual storage chip. I cracked open an old flash drive for fun a couple weeks back, and most of its physical volume was actually case and air.
Jan
1
comment How can I securely delete the contents of a thumb drive so data can't be recovered.
@Polarbear0106 This question is about how to render data unrecoverable. What said data is is outside the scope of the question, and, frankly, none of your business.
Jan
1
comment How can I securely delete the contents of a thumb drive so data can't be recovered.
A flash drive? Crack the thing open, pry all the chips off of the green circuit board thingy, and mash them up into itty bitty shiny little pieces, then go buy another one. Physical destruction is really the only way to be sure, 'cos of all the wear-leveling and stuff. In the future, use full-disk encryption and lose the keys|password when you don't want it anymore.
Dec
31
comment What does “echo (ls)” do in bash?
What does echo (ls) do? Generate an error. What does echo $(ls) do? Pretty much the same thing as ls, making the echo and command substitution redundant. If you're using it for testing, stop: don't try to parse ls output.
Dec
23
comment Is there any reason to have a shebang pointing at /bin/sh rather than /bin/bash?
No, you should not use #!/bin/env anything in a portable script. It is perfectly reasonable to assume that /bin/sh exists and is a working, POSIX-compliant shell. On the other hand, none of my systems have a /bin/env.
Dec
23
comment Is there any reason to have a shebang pointing at /bin/sh rather than /bin/bash?
Well, not all implementations of /bin/sh; just the POSIX-compliant ones.
Dec
23
comment Is there any reason to have a shebang pointing at /bin/sh rather than /bin/bash?
@schily time $shell -c '' seems to me like a good way of measuring the time a shell takes to start and to exit.
Dec
19
comment What is the difference between “du -sh *” and “du -sh ./*”?
@Wildcard A robust script wouldn't invoke du and then try to parse its output, for exactly the reasons detailed previously in this comment thread.
Dec
16
revised How do I pipe the output of tar through mv?
tweaked wording and formatting (including reindenting to fit SE's four-space convention)
Dec
16
suggested approved edit on How do I pipe the output of tar through mv?
Nov
30
comment protocol version mismatch (client 8, server 6) when trying to upgrade
@PeterV.Mørch The /proc/$pid/exe files aren't regular symlinks; you should be able to use them to invoke the relevant programs even if they've been unlinked.
Nov
24
comment Is it considered a best practice to not use capital letters in file naming?
That's a conscious choice on your part to avoid using some characters, rather than a limitation built into the system (in this example, the Wi-Fi standards, AP and client implementations, etc). If you're using a string of randomly-selected characters as a password, you can improve readability by using (or encouraging the recipients to use) a monospace font, or by simply using more distinctive glyphs if you're handwriting them (seriffed lowercase L, uppercase I, and digit 1; smaller lowercase O, rounder uppercase O, slashed or dotted digit 0; etc). Alternatively, you could use a passphrase.
Nov
23
comment Is it considered a best practice to not use capital letters in file naming?
The last thing is something that should be handled by the authenticating system, not the user coming up with the password. If the system limits the set of allowed characters in passwords, it is a bad system.
Nov
23
comment Right-to-left shell brace expansion
@terdon So basically this answer works if you take out the across-before-down bit.
Nov
22
comment Finish entering text in GPG
Anyway, I find typing directly into a file or a program's stdin mostly useful for testing things and other cases when mistakes don't matter or I'm not likely to make a mistake spanning multiple lines. If you need to do any kind of composition beyond that, you'd be better served by the editor of your choice.
Nov
22
comment Finish entering text in GPG
@tchen Fun fact: pressing control-d actually also flushes input in the same way. Pressing it when you've just flushed (either with control-d or with return) still flushes, only it flushes zero bytes (making the read() system call return 0), which is how the system communicates that the end of a file has been reached. Sometimes (usually not, but sometimes!), a program will keep reading even after it's gotten the end-of-file indication. Off the top of my head, gnutls-cli does this when you pass --starttls.
Nov
22
comment Finish entering text in GPG
@tchen No, it is not possible. This is because pressing return causes what you've typed so far to be flushed into the input buffer of the program (or file, or whatever keyboard input happens to be connected to)—once that happens, it's likely that the program is already operating on it (or that it's already being written to the file, or…), so there isn't an easy way to undo it.