* [9fans] how to delete directories prefixed with a dash @ 2004-06-16 3:34 Skip Tavakkolian 2004-06-16 4:48 ` Geoff Collyer ` (3 more replies) 0 siblings, 4 replies; 19+ messages in thread From: Skip Tavakkolian @ 2004-06-16 3:34 UTC (permalink / raw) To: 9fans I think i did a 'mkdir -p -m 777 xxx' , before either flag was supported and thus created a -p and a -m directory. I finally removed them by cd'ing to those dirs and doing a 'rm .'; What's the quoting rule to get that type of name past the flags processing in rm (or anything else that has flags)? ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [9fans] how to delete directories prefixed with a dash 2004-06-16 3:34 [9fans] how to delete directories prefixed with a dash Skip Tavakkolian @ 2004-06-16 4:48 ` Geoff Collyer 2004-06-16 5:11 ` Don Bailey 2004-06-16 4:55 ` Don Bailey ` (2 subsequent siblings) 3 siblings, 1 reply; 19+ messages in thread From: Geoff Collyer @ 2004-06-16 4:48 UTC (permalink / raw) To: 9fans There's also the getopt convention, implemented by arg(2): rm -- -m -p ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [9fans] how to delete directories prefixed with a dash 2004-06-16 4:48 ` Geoff Collyer @ 2004-06-16 5:11 ` Don Bailey 2004-06-16 8:48 ` Douglas A. Gwyn 0 siblings, 1 reply; 19+ messages in thread From: Don Bailey @ 2004-06-16 5:11 UTC (permalink / raw) To: Fans of the OS Plan 9 from Bell Labs sickening. I leave to party and compose some music, then come back to find gnu9? Geoff Collyer wrote: >There's also the getopt convention, implemented by arg(2): > > rm -- -m -p > > > > ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [9fans] how to delete directories prefixed with a dash 2004-06-16 5:11 ` Don Bailey @ 2004-06-16 8:48 ` Douglas A. Gwyn 2004-06-16 11:45 ` Russ Cox 2004-06-16 22:37 ` Don Bailey 0 siblings, 2 replies; 19+ messages in thread From: Douglas A. Gwyn @ 2004-06-16 8:48 UTC (permalink / raw) To: 9fans Don Bailey wrote: > sickening. I leave to party and compose some music, then come > back to find gnu9? Getopt (including the -- convention) was developed at Bell Labs over 20 years ago. If you're not using it, shame on you. ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [9fans] how to delete directories prefixed with a dash 2004-06-16 8:48 ` Douglas A. Gwyn @ 2004-06-16 11:45 ` Russ Cox 2004-06-16 13:32 ` C H Forsyth 2004-06-16 13:45 ` boyd, rounin 2004-06-16 22:37 ` Don Bailey 1 sibling, 2 replies; 19+ messages in thread From: Russ Cox @ 2004-06-16 11:45 UTC (permalink / raw) To: Fans of the OS Plan 9 from Bell Labs > Getopt (including the -- convention) was developed at > Bell Labs over 20 years ago. If you're not using it, > shame on you. You're preaching to the wrong crowd. Essentially no code here uses getopt. Russ ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [9fans] how to delete directories prefixed with a dash 2004-06-16 11:45 ` Russ Cox @ 2004-06-16 13:32 ` C H Forsyth 2004-06-16 13:45 ` boyd, rounin 1 sibling, 0 replies; 19+ messages in thread From: C H Forsyth @ 2004-06-16 13:32 UTC (permalink / raw) To: 9fans [-- Attachment #1: Type: text/plain, Size: 232 bytes --] just to avoid damnation, that's because it uses arg(2) which is similar in intent except that it's simpler and the interface doesn't rely on globals, so it can be used to crack argv parameters to internal threads (if you like). [-- Attachment #2: Type: message/rfc822, Size: 2732 bytes --] From: Russ Cox <russcox@gmail.com> To: Fans of the OS Plan 9 from Bell Labs <9fans@cse.psu.edu> Subject: Re: [9fans] how to delete directories prefixed with a dash Date: Wed, 16 Jun 2004 07:45:06 -0400 Message-ID: <ee9e417a04061604456cd6b853@mail.gmail.com> > Getopt (including the -- convention) was developed at > Bell Labs over 20 years ago. If you're not using it, > shame on you. You're preaching to the wrong crowd. Essentially no code here uses getopt. Russ ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [9fans] how to delete directories prefixed with a dash 2004-06-16 11:45 ` Russ Cox 2004-06-16 13:32 ` C H Forsyth @ 2004-06-16 13:45 ` boyd, rounin 2004-06-16 13:57 ` rog 2004-06-17 9:05 ` Douglas A. Gwyn 1 sibling, 2 replies; 19+ messages in thread From: boyd, rounin @ 2004-06-16 13:45 UTC (permalink / raw) To: Fans of the OS Plan 9 from Bell Labs > You're preaching to the wrong crowd. yeah, why use -- when ./ will do it? no extra code for ./ unlike -- ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [9fans] how to delete directories prefixed with a dash 2004-06-16 13:45 ` boyd, rounin @ 2004-06-16 13:57 ` rog 2004-06-16 13:58 ` Dave Lukes 2004-06-17 9:05 ` Douglas A. Gwyn 1 sibling, 1 reply; 19+ messages in thread From: rog @ 2004-06-16 13:57 UTC (permalink / raw) To: 9fans > yeah, why use -- when ./ will do it? no extra code for ./ unlike -- ./ won't work with grep, or other commands that take arguments that aren't filenames. also, in a shell script, rm ./$1 isn't correct. -- is standard. ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [9fans] how to delete directories prefixed with a dash 2004-06-16 13:57 ` rog @ 2004-06-16 13:58 ` Dave Lukes 2004-06-16 15:01 ` Skip Tavakkolian 2004-06-16 16:32 ` rog 0 siblings, 2 replies; 19+ messages in thread From: Dave Lukes @ 2004-06-16 13:58 UTC (permalink / raw) To: Fans of the OS Plan 9 from Bell Labs > ./ won't work with grep, or other commands that > take arguments that aren't filenames. <devils-advocate> ... but grep understands \\:-). > also, in a shell script, > > rm ./$1 > > isn't correct. Why not? > -- is standard. So are the above:-). </devils-advocate> DaveL ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [9fans] how to delete directories prefixed with a dash 2004-06-16 13:58 ` Dave Lukes @ 2004-06-16 15:01 ` Skip Tavakkolian 2004-06-18 9:38 ` Dave Lukes 2004-06-16 16:32 ` rog 1 sibling, 1 reply; 19+ messages in thread From: Skip Tavakkolian @ 2004-06-16 15:01 UTC (permalink / raw) To: 9fans > <devils-advocate> davel's-advocate? ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [9fans] how to delete directories prefixed with a dash 2004-06-16 15:01 ` Skip Tavakkolian @ 2004-06-18 9:38 ` Dave Lukes 0 siblings, 0 replies; 19+ messages in thread From: Dave Lukes @ 2004-06-18 9:38 UTC (permalink / raw) To: Fans of the OS Plan 9 from Bell Labs Skip Tavakkolian wrote: > davel's-advocate? > Old joke. Someone at Morgan Stanley (Brian Redman IIRC) once enhanced my X-Face: with horns and a tail. D[ae]v[ei]L. ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [9fans] how to delete directories prefixed with a dash 2004-06-16 13:58 ` Dave Lukes 2004-06-16 15:01 ` Skip Tavakkolian @ 2004-06-16 16:32 ` rog 2004-06-18 9:20 ` Dave Lukes 1 sibling, 1 reply; 19+ messages in thread From: rog @ 2004-06-16 16:32 UTC (permalink / raw) To: 9fans > ... but grep understands \\:-). and...? > > rm ./$1 > > > > isn't correct. > > Why not? 'cos you might want to give an argument that's not relative to the current directory? ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [9fans] how to delete directories prefixed with a dash 2004-06-16 16:32 ` rog @ 2004-06-18 9:20 ` Dave Lukes 0 siblings, 0 replies; 19+ messages in thread From: Dave Lukes @ 2004-06-18 9:20 UTC (permalink / raw) To: Fans of the OS Plan 9 from Bell Labs rog@vitanuova.com wrote: >>... but grep understands \\:-). > > > and...? ... and you can do: grep \\-... >>> rm ./$1 >>> >>>isn't correct. >> >>Why not? > > > 'cos you might want to give an argument that's not relative > to the current directory? In which case you say rm /.... and there's no '-' problem, right? DaveL. ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [9fans] how to delete directories prefixed with a dash 2004-06-16 13:45 ` boyd, rounin 2004-06-16 13:57 ` rog @ 2004-06-17 9:05 ` Douglas A. Gwyn 1 sibling, 0 replies; 19+ messages in thread From: Douglas A. Gwyn @ 2004-06-17 9:05 UTC (permalink / raw) To: 9fans boyd, rounin wrote: > yeah, why use -- when ./ will do it? no extra code for ./ unlike -- Not all nonoption arguments that might start with a - character are pathnames. ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [9fans] how to delete directories prefixed with a dash 2004-06-16 8:48 ` Douglas A. Gwyn 2004-06-16 11:45 ` Russ Cox @ 2004-06-16 22:37 ` Don Bailey 2004-06-16 23:56 ` Geoff Collyer 1 sibling, 1 reply; 19+ messages in thread From: Don Bailey @ 2004-06-16 22:37 UTC (permalink / raw) To: Fans of the OS Plan 9 from Bell Labs > > Getopt (including the -- convention) was developed at > Bell Labs over 20 years ago. If you're not using it, > shame on you. I was making a joke on how the state of things changed while I've been gone. It seems the state of pro and anti GNU buzz (as there always has been) has began to escalate due to portability desires, etc. However, I don't believe the -- issue is particularly relevant to getopt, since plan9 doesn't even use getopt, so, shame on you. Apparently, you don't use it either. Worse yet, you don't know that you don't use it. Excuse my lack of emoticons or <sarc></sarc> tags: Booze Brother Shirani has still got me on sarcastic time and I think I'll be experiencing jet lag for a few more days. Don ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [9fans] how to delete directories prefixed with a dash 2004-06-16 22:37 ` Don Bailey @ 2004-06-16 23:56 ` Geoff Collyer 0 siblings, 0 replies; 19+ messages in thread From: Geoff Collyer @ 2004-06-16 23:56 UTC (permalink / raw) To: 9fans Real getopt has nothing to do with gnu. gnu has several flavours of extended getopt-like functions, but that's not relevant here. I was just pointing out that arg(2) implements the same "--" convention as getopt, so all programs that use arg(2) for option parsing get it for free. And yes, I rarely use it, preferring "rm ./-p" and "grep '*-p'" or "grep .-p". ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [9fans] how to delete directories prefixed with a dash 2004-06-16 3:34 [9fans] how to delete directories prefixed with a dash Skip Tavakkolian 2004-06-16 4:48 ` Geoff Collyer @ 2004-06-16 4:55 ` Don Bailey 2004-06-16 4:57 ` Russ Cox 2004-06-16 5:39 ` Charles Forsyth 3 siblings, 0 replies; 19+ messages in thread From: Don Bailey @ 2004-06-16 4:55 UTC (permalink / raw) To: Fans of the OS Plan 9 from Bell Labs rm ./-p Skip Tavakkolian wrote: >I think i did a 'mkdir -p -m 777 xxx' , before either flag was supported >and thus created a -p and a -m directory. I finally removed them by >cd'ing to those dirs and doing a 'rm .'; > >What's the quoting rule to get that type of name past the flags >processing in rm (or anything else that has flags)? > > > > ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [9fans] how to delete directories prefixed with a dash 2004-06-16 3:34 [9fans] how to delete directories prefixed with a dash Skip Tavakkolian 2004-06-16 4:48 ` Geoff Collyer 2004-06-16 4:55 ` Don Bailey @ 2004-06-16 4:57 ` Russ Cox 2004-06-16 5:39 ` Charles Forsyth 3 siblings, 0 replies; 19+ messages in thread From: Russ Cox @ 2004-06-16 4:57 UTC (permalink / raw) To: Fans of the OS Plan 9 from Bell Labs > I think i did a 'mkdir -p -m 777 xxx' , before either flag was supported > and thus created a -p and a -m directory. I finally removed them by > cd'ing to those dirs and doing a 'rm .'; > > What's the quoting rule to get that type of name past the flags > processing in rm (or anything else that has flags)? rm -- -p ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [9fans] how to delete directories prefixed with a dash 2004-06-16 3:34 [9fans] how to delete directories prefixed with a dash Skip Tavakkolian ` (2 preceding siblings ...) 2004-06-16 4:57 ` Russ Cox @ 2004-06-16 5:39 ` Charles Forsyth 3 siblings, 0 replies; 19+ messages in thread From: Charles Forsyth @ 2004-06-16 5:39 UTC (permalink / raw) To: 9fans -p is one thing i suppose, but -m 777 seems a little pointless. actually, -m probably is fairly pointless all round. as on Unix, on Plan 9 it probably doesn't do what you might think, although Unix and Plan 9 don't do that in different ways. on Unix it applies only to the last component and is subject to umask, and intervening directories get -m $(umask -S),u+wx; on Plan 9 the mode applies to all directories (so -m 555 -p not/there/yet won't work at all) and in each case is subject to masking by the parent directory permissions, so -m 777 produces completely-writable directories only if the old create(..., DMDIR|0777) would have done anyway. now on Plan 9, mkdir -p -m 700 ... does make a difference (starting in a directory with mode 755 say) and will set the mode 700 on each new directory; although that differs from Unix where with my umask 022 i get 755 directories up to the last created, which is 700. of course in all cases, on Plan 9 and Unix, if mkdir doesn't create the directory (eg, intervening ones with -p), it doesn't change the mode, so be sure to do rm -r or rm -r -- first. that's presumably why the Unix one has the definition it's got. it's not that useful but it behaves consistently not-that-usefully with -p regardless whether the directories are created or not. at least i think so; that's what the Unix manual pages and code suggests, supported by experiment on Plan 9 and Unix. all in all, i confess i did wonder when it appeared several months ago why -m was in Plan 9 outside APE. still it's only 80 lines compared with 212 on FreeBSD (but then that includes the BSD copyright and licence, and /* * POSIX 1003.2: * For each dir operand that does not name an existing * directory, effects equivalent to those cased by the * following command shall occcur: * * mkdir -p man 2 $(dirname dir) && * mkdir [-m mode] dir * * We change the user's umask and then restore it, * instead of doing chmod's. */ and /* * The mkdir() and umask() calls both honor only the low * nine bits, so if you try to set a mode including the * sticky, setuid, setgid bits you lose them. Don't do * this unless the user has specifically requested a mode, * as chmod will (obviously) ignore the umask. */ i wonder why i got out of bed this morning. after the above, you'll probably wish i'd stayed there too! ^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2004-06-18 9:38 UTC | newest] Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2004-06-16 3:34 [9fans] how to delete directories prefixed with a dash Skip Tavakkolian 2004-06-16 4:48 ` Geoff Collyer 2004-06-16 5:11 ` Don Bailey 2004-06-16 8:48 ` Douglas A. Gwyn 2004-06-16 11:45 ` Russ Cox 2004-06-16 13:32 ` C H Forsyth 2004-06-16 13:45 ` boyd, rounin 2004-06-16 13:57 ` rog 2004-06-16 13:58 ` Dave Lukes 2004-06-16 15:01 ` Skip Tavakkolian 2004-06-18 9:38 ` Dave Lukes 2004-06-16 16:32 ` rog 2004-06-18 9:20 ` Dave Lukes 2004-06-17 9:05 ` Douglas A. Gwyn 2004-06-16 22:37 ` Don Bailey 2004-06-16 23:56 ` Geoff Collyer 2004-06-16 4:55 ` Don Bailey 2004-06-16 4:57 ` Russ Cox 2004-06-16 5:39 ` Charles Forsyth
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).