Reputation
374
Top tag
Next privilege 500 Rep.
Access review queues
Badges
1 4 12
Impact
~39k people reached

  • 0 posts edited
  • 1 helpful flag
  • 31 votes cast
Sep
17
awarded  Good Question
Sep
10
accepted How to copy a folder recursively in an idempotent way using cp?
Sep
10
awarded  Nice Question
Sep
10
comment How to copy a folder recursively in an idempotent way using cp?
@R.. can you provide an example? @muru I'd like this to work in MINGW which does not have rsync shipped.
Sep
10
awarded  Curious
Sep
9
comment How to copy a folder recursively in an idempotent way using cp?
I've tested the inputFolder/. instead of inputFolder and indeed it works for me on Windows/Git Bash. (It does not work however with just a trailing /, I need also the dot after the slash). I gave +1 since it's interesting, though it's probably a bit too tricky to use it in public code :)
Sep
9
awarded  Notable Question
Sep
9
comment How to copy a folder recursively in an idempotent way using cp?
Yeah, it seems that this is exactly what I wanted: cp -T (cp --no-target-directory). unix.stackexchange.com/questions/94831/… Unfortunately my version of cp is much older.
Sep
9
revised How to copy a folder recursively in an idempotent way using cp?
added 132 characters in body
Sep
9
asked How to copy a folder recursively in an idempotent way using cp?
Mar
27
awarded  Popular Question
Feb
16
asked Why Git Bash always suggests me a `debug` autocompletion?
Feb
2
revised Creating a shebang pointing portably to an interpreter in the folder of a script
added 339 characters in body
Feb
2
comment Creating a shebang pointing portably to an interpreter in the folder of a script
I actually use iojs which is a fork of node (but still has node executable for backward compat reasons); It enables V8 engine experimental features to run; see node --v8-options
Feb
2
awarded  Yearling
Feb
1
comment Creating a shebang pointing portably to an interpreter in the folder of a script
Nope it doesn't; you can test with a simple JS file being console.log(process.argv) and then node file.js -q vs echo console.log(process.argv) | node -q. The latter fails with "bad option: -q". Also the sed hack makes the script work fine when run as ./file.js but makes it fail when run as node ./file.js. I guess there can't be produced a good workaround following this way.
Feb
1
comment Creating a shebang pointing portably to an interpreter in the folder of a script
I just realized your hack is not bulletproof since it prohibits passing the parameters to the script. E.g. ./file.js -param, normally this sets process.argv[2] == "-param", but when piping the script text to the node interpreter, this gets lost. Making this work would probably need even more hacks, not sure I need it that much ;)
Feb
1
comment Creating a shebang pointing portably to an interpreter in the folder of a script
Interesting but doesn't work on Windows, AFAIK // is used by Git Bash as the prefix for network shares (equivalent to \\ prefix in Windows).
Feb
1
awarded  Commentator
Feb
1
comment Creating a shebang pointing portably to an interpreter in the folder of a script
That's pretty hacky but it worked for me (sed '1,2d' "$0" | node --harmony_arrow_functions ; exit $?), +1, thanks :)