18,045 reputation
13664
bio website
location United States
age
visits member for 2 years, 8 months
seen 2 hours ago

Debian user, GNU/Linux enthusiast, FLOSS supporter, hobby developer.


Nov
20
comment Script is stuck saying 1 response with 2 available: Math related
The if then snippet you posted should work fine - only one branch should ever execute. Are you sure you pasted it exactly as is?
Oct
10
comment Ignore “other” domains when downloading with wget?
Something is wrong here. wget should not cross hosts by default, and you need the -H/--span-hosts option to cross hosts when doing a recursive wget. "www.website.com" is a completely different host from "www.website.de".
Oct
10
comment Why is sort -o useful?
@uprego neither sponge nor moreutils were actually created by GNU.
Oct
10
comment Why is sort -o useful?
Just to play devil's advocate, there are actually alternatives to both the "input file is same as output file" problem and "privileged redirection" problem, and both alternatives are more in the spirit of "do one thing well". For "input = output", there is sponge (part of moreutils). For privileged redirection there is piping to | sudo tee, which also has the benefit of limiting privilege escalation to a single simple program, tee.
Sep
10
comment What does the Windows flag in the Linux logo of kernel 3.11 mean?
"seance" - autocorrect I presume? I don't think Vista is quite dead yet.
Sep
3
comment Where is the fork() on the fork bomb :(){ :|: & };:?
@shadyabhi It's simple - x and y are 2 separate commands running in 2 separate processes, so you have 2 separate subshells. If x runs in the same process as the shell, that means x must be a built-in.
Aug
29
comment Why did a new user inherit files from a deleted user?
@MSalters I don't think the need for policy enforcement is a problem unless I am misunderstanding you. Even in the real world, when a person suddenly dies without a will or close living relations, his possessions become "orphaned" and some policy somewhere dictates what to do with it (donate it? burn it? auction it?). The situation in the question is like a landlord simply giving the dead person's apartment to some new renter, leaving new guy to inherit all the deceased person's stuff. Policies exist to prevent this sort of chaos (e.g. delete a user's $HOME and other files before userdel).
Aug
27
comment Why did a new user inherit files from a deleted user?
@MSalters I don't think it's that big of a problem, seeing as it is something that can be covered by policy rather than any sort of exploit. When you orphan files like that what do you expect to happen? It's like use-after-free in programming - undefined behavior results. Standard procedure is to delete files associated with an account at the time of account deletion. If those files cannot be deleted, ownership should be transferred to a different account. If that's still not feasible then obviously the account still needs to exist and should not be deleted.
Jul
30
comment Is this a typo in Bash manual's redirection section?
A classic case of mixing up operations that are "by value" vs "by reference". When you duplicate a file descriptor it is a by value operation. In programming, after a = 1; b = a; a = 2 you expect a == 2 && b == 1 to be true. The redirection 2>&1 is similar to the b = a assignment - it is by value, not by reference. 2>&1 does not wed file descriptor 2 to file descriptor 1 for all of eternity - they are still 2 distinct file descriptors, who happen to point to the same file.
Jul
26
comment Tell a regex expression to skip the beginning of a line before matching
If you just want to exclude spaces add that: [^\/ ]. What is your ultimate goal? It sounds like you are doing some tricky filename parsing / formatting, and usually that's never a clean and easy task.
Jul
23
comment Reusing pipe data for different commands
@Gilles Ah, ok. Thanks.
Jul
23
comment Reusing pipe data for different commands
@Gilles Not even reading one character at a time and using ungetc()?
Jul
22
comment Reusing pipe data for different commands
Unfortunately I don't think there is any general solution to this. Ideally, commands should put back anything they read that they don't use but with pipes that is not always possible. Even if they did you would have to trust the commands to do so - there's no way for the shell to enforce any such agreement. For specific solutions you can come up with your own custom script to replace everything inside the { }.
Jul
22
comment Reusing pipe data for different commands
I don't think this answers what the OP is trying to do. The idea is for sequential commands to each consume a portion of the same pipe stream, each picking up exactly where the previous one left off.
Jul
22
comment How to chmod without /usr/bin/chmod?
Couldn't you just use cat instead of dd?
Jul
17
comment How to keep dotfiles system-agnostic?
My approach basically boils down to if (exists rcfile.local); source rcfile.local; endif, translated to the appropriate rc file. The main rc file I try to keep system agnostic, while the .local version has system specific settings. If you want it all in a single repo you can have system dirs and symlink the rcfile.local to the one in the correct directory.
Jul
17
comment sudo hangs when run on remote host over ssh in a script without tty (-t)
Does running sudo on the remote server require a password?
Jul
16
comment Bash operator & not working
Is it because you have no space between the & and the end of your command?
Jul
11
comment Multiline shell script comments - how does this work?
The choice of single quote or double quote should hardly be influenced by something as trivial and irrelevant a concern as whether the text of your script is itself a valid single-quoted string. Single quotes are used to prevent expansions, while double quotes allow certain expansions and require extra parsing. This is the real criteria for determining which to use.
Jul
3
comment Why should I use $[ EXPR ] instead of $(( EXPR ))?
@qdii As a general rule of thumb the application's own man page and official documentation have much more weight / authority / credibility than some external guide. TLDP does not have the best quality documentation for shell scripting unfortunately. If you want to get good solid information on bash scripting I'd check out the Wooledge wiki.