Article View: comp.mail.mh
Article #1998Re: "folder", "inc", "refile" hang or create folder you might not want
From: John Romine
Date: Thu, 01 Mar 1990 19:02
Date: Thu, 01 Mar 1990 19:02
43 lines
2375 bytes
2375 bytes
jdpeek@rodan.acs.syr.EDU (Jerry Peek) writes about "folder +inboz"
querying you to create +inboz if it doesn't exist
From the folder man page:
If the specified (or default) folder doesn't exist, the user
will be queried if the folder should be created. (This is
the easy way to create an empty folder for use later.)
Folder checks to see whether stdin (not stdout or stderr) is a tty or
not. If it's not a tty, it doesn't ask questions, it just assumes a
reasonable answer: in this case "yes".
Some history:
It used to be "folder +inboz" was considered an error if +inboz didn't
exist. I requested [mostly for shell script use] that it create the
folder instead of being an error. The alternative was to use "mkdir
`mhpath +inboz`".
If folder was called interactively, we decided that querying the user
seemed reasonable. Some other MH programs do this under some
circumstances as well. There was considerable discussion about whether
changing the default behavior and querying the user were "good things".
Your current choices for shell scripts are:
1. redirect stdin and the folder will be created.
2. Let the user decide when folder gives its query.
I treat MH scripts like MH programs: if you're running something that
will be interactive, let folder, et. al., query the user if it needs to.
If you're running something that won't be interactive, assume the user
typed what he meant (i.e., just create +inboz and use it). Nearly all
UNIX programs assume the latter, so it seems like that's what a user
would expect to happen.
If you want to abort if the folder doesn't exist, you have to use
"test -d" as you mentioned. MH programs have become more user-oriented
and less tool-oriented. As I mentioned above, this isn't necessarily
a "good thing". Of course, you can do almost anything you want by
calling "mhpath" and using standard UNIX tools.
--
John Romine
Technical Details
Message-ID:
<25ED71C5.1340@paris.ics.uci.edu>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!jarthur!uci-ics!jromineReferences:
<9003011300.AA22789@rodan.acs.syr.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!jarthur!uci-ics!jromine From: jromine@ics.uci.edu (John Romine) Newsgroups: comp.mail.mh Subject: Re: "folder", "inc", "refile" hang or create folder you might not want Message-ID: <25ED71C5.1340@paris.ics.uci.edu> Date: 1 Mar 90 19:02:30 GMT References: <9003011300.AA22789@rodan.acs.syr.edu> Reply-To: jromine@ics.uci.edu (John Romine) Organization: UC Irvine Department of ICS Lines: 43