1,194 reputation
49
bio website jan.moesen.nu
location Belgium
age 33
visits member for 3 years
seen Aug 23 at 7:48

I still write "Internet" with a capital I. Does that mean I am officially old?

Some of my dot files are available in my Tilde repository on GitHub.

I use several productivity-enhancing bookmarklets for easier web browsing.


Oct
11
awarded  Yearling
May
23
comment How to report number of files in all subdirectories?
@toxalot: I didn't bother adding it as an answer because it was so short (and possibly slightly condescending in tone). Feel free to upvote the comment. :-) Also, the question is somewhat vague with regards to what "how many files" means. My solution counts "regular" files and directories; maybe the poster really meant "files, not directories". Another thing to keep in mind is that this globbing does not take "hidden" dot files into account. There are ways around both of those gotchas, though. But again: not sure of the original poster's exact requirements.
Oct
11
awarded  Yearling
Oct
11
awarded  Yearling
Sep
22
comment List X random files from a directory
Gilles: quite right, which is why I said "Note that neither version takes duplicates into account." You could still do it in pure Bash, if you do not care about time complexity and rebuild the array each time you remove a random one from it. Not even close to a one-liner, then, but of course that was not a requirement.
Sep
18
comment List X random files from a directory
This is the quick and dirty way, and I would use it, too — for a one-off script. For anything more durable, avoid parsing the output of ls.
Sep
18
answered List X random files from a directory
Jul
19
comment Difference between “echo $SHELL” and “which bash”
Allow me to spamvertise the wtfis function from my dotfiles: github.com/janmoesen/tilde/blob/01a9f86/.bash/commands#L719 — it combines type, file and ls to show as much information as possible.
Jul
16
comment Piping in awk scripts
If you would still like to build your own, you might want to have a look at stat and build the desired output yourself, instead of tweaking the output of ls.
Jul
16
answered Execute remote script with local parameter value
Jul
16
comment Execute remote script with local parameter value
Note that if $myparameter contains spaces, it will split on the server side. Bash's printf has a %q format that you could use. I have some example code, but it does not fit here. I'll create a new answer for it.
Jul
5
answered is there any command like “wall” that runs a “command” in all terminals
May
31
answered Execute on the basename of a find command
Mar
29
comment using watch with ssh
Never mind my answer. The forced pseudo-tty allocation is much easier.
Mar
28
answered Why does sftp hide the log from stdout?
Mar
28
answered using watch with ssh
Mar
28
answered how to forbid a command without a permission
Mar
28
comment How to make `find` output full absolute file names?
Even so you should quote that: "`pwd`". Try it: mkdir '/tmp/foo bar' && cd !#:1 && find `pwd`; rmdir !#:1.
Nov
22
revised How can I make bash more readable?
fix typo: should be double quotes, not backticks around the variable (the rest is padding: "Edits must be at least 6 characters;" — meh)
Nov
22
suggested suggested edit on How can I make bash more readable?