Reputation
Top tag
Next privilege 25,000 Rep.
Access to site analytics
Badges
3 58 93
Newest
 Nice Answer
Impact
~1.3m people reached

Apr
8
comment How to act on output from a failed command
What are you trying to accomplish? Just sudo apt-get install python-setuptools and be done with it.
Apr
7
comment How does this shell command work?
Just wanted to point out the UUOC (useless use of cat). ssh b@B 'cat >> .ssh/authorized_keys' < .ssh/id_rsa.pub is better.
Apr
5
comment Variable substitution into a sed script
Instead of sed -i you should look into ed as well. sed -i breaks links and is not very portable but if you don't have to worry about either, then it may be fine.
Apr
5
comment Quick way to include a directory path when calling mv?
I remember seeing a question with an accepted answer nearly identical to mine. However I cannot find it so I've answered your question for now, at least until someone stumbles across the link.
Apr
2
comment What is a good X terminal not from a major window environment?
All the times I have tried it, I never have found transparency in terminals to be anything except distracting eye-candy at the expense of usability. Having random background noise bleed through the text makes it harder to read, even if you apply a generous gaussian blur to the background layer. If you really desire light-weight or minimalist, I'd recommend dropping this "feature" from your shopping list.
Apr
2
comment How can I delete lines that has an empty first column?
You should be asking the OP whether it matters, not me. I'm just here to point out that the /^\s\s*/d will let lines like |... slip through whereas /^\s*|/d will not.
Apr
2
comment How can I delete lines that has an empty first column?
How about /^\s*|/d?
Apr
2
comment How can I create a file with multiple lines from the command-line?
Best answer, IMO.
Apr
2
comment Recursively search folder but exclude svn subfolder
or perhaps you want to use --recursive . instead, seeing as the OP already has GNU grep.
Apr
2
comment Four tasks in parallel… how do I do that?
@DigitalRobot You can try it for yourself but the xargs man page seems to imply it will try to keep 4 processes running at all times.
Apr
2
comment Light GUI user interfaces
Are you looking for a full DE? Many people seem to be suggesting window managers but if you go that route you'll have the burden/freedom of choosing all your DE components like pagers, panels, file managers, etc. yourself.
Apr
1
comment Editing a file without overwrite permission
@Mat is right. This doesn't make any sense. What are you trying to do?
Apr
1
comment Four tasks in parallel… how do I do that?
@EugeneS It's for maximum correctness and robustness. File names are not lines, and ls cannot be used to parse filenames portably and safely. The only safe characters to use to delimit file names are \0 and /, since every other character, including \n, can be part of the file name itself. The printf uses \0 to delimit file names, and the -0 informs xargs of this. The -I{} tells xargs to replace {} with the argument.
Apr
1
comment Four tasks in parallel… how do I do that?
@EugeneS Could you be a bit more specific about what part? The printf collects all png files and passes them via a pipe to xargs, which collects arguments from standard input and combines them into arguments for the pngout command the OP wanted to run. The key option is -P 4, which tells xargs to use up to 4 concurrent commands.
Apr
1
comment Is it possible to reference the most recently modified file in a command line argument?
@user1247 You have to make all your functions look like, e.g. cdtest () { cd "$@"; }, and then they should work with arguments.
Mar
31
comment Home key acting strange in bash (tty and X) on long input strings
@LevLevitsky I added a short explanation to the answer.
Mar
31
comment Four tasks in parallel… how do I do that?
Just to explain my fixes to the code: (1) As a matter of style, avoid all uppercase variable names as they potentially conflict with internal shell variables. (2) Added quoting for $f etc. (3) Use [ for POSIX compatible scripts, but for pure bash [[ is always preferred. In this case, (( is more appropriate for the arithmetic.
Mar
31
comment Is it possible to reference the most recently modified file in a command line argument?
@user1247 type set -x (turn on xtrace) and try again and see what it tells you.
Mar
31
comment Is it possible to reference the most recently modified file in a command line argument?
@user1247 Sorry I got distracted from the bigger picture. The fundamental problem is aliases are expanded when functions are read, not when they are executed. The function expands its arguments to obtain the command to run, so passing in aliases won't work. The solution is simple: change your aliases to functions, which do work, since functions supersede aliases anyways.
Mar
31
comment Is it possible to reference the most recently modified file in a command line argument?
@user1247 I would just copy paste it instead of sourcing it, since you have to tweak it anyways. last_file () { #copy paste code here }. The only change to make is to change the exit to return, so the function doesn't exit your shell.