Skip to main content
12 events
when toggle format what by license comment
Dec 18, 2018 at 12:44 comment added Jase The zsh hint at the end is amazing, it saved me so much time!
Sep 24, 2012 at 15:49 vote accept Andrew
Sep 21, 2012 at 14:56 history edited Random832 CC BY-SA 3.0
added 132 characters in body
Sep 21, 2012 at 14:50 comment added Random832 I thought about adding a version using arithmetic expansion, but wanted to limit "pure sh" to stuff that would have worked on pre-POSIX versions as well. I also didn't mention seq for the same reason - if you have seq you probably have bash. The loop example is also good for bypassing argument limits for a larger number of directories, which also means there's a place for for i in {range} for users of advanced shells.
S Sep 21, 2012 at 14:46 history suggested Stéphane Chazelas CC BY-SA 3.0
Some knitpick edits so it doesn't rely on the current value of $IFS
Sep 21, 2012 at 14:35 review Suggested edits
S Sep 21, 2012 at 14:46
Sep 21, 2012 at 12:23 comment added rahmu @kojiro: [[ works on my ksh88 (which predates bash) so I assumed it was POSIX. I couldn't find any mention of it in the POSIX spec so I believe you're right. Thanks for the info!
Sep 21, 2012 at 12:03 comment added kojiro @rahmu the [[ keyword is not POSIX. (Not to mention that [ is a shell builtin in many modern shells.)
Sep 21, 2012 at 9:28 history edited rahmu CC BY-SA 3.0
added 387 characters in body
Sep 21, 2012 at 5:04 comment added kojiro +1 This is great! I gotta nitpick about one thing, though: n=$(( n + 1 )) would've been just as strictly POSIX and wouldn't cost you a subshell.
Sep 20, 2012 at 22:41 history edited Stéphane Gimenez CC BY-SA 3.0
added 9 characters in body
Sep 20, 2012 at 22:35 history answered Random832 CC BY-SA 3.0