View Issue Details

IDProjectCategoryView StatusLast Update
00013681003.1(2016/18)/Issue7+TC2Shell and Utilitiespublic2024-06-11 09:08
Reportersteffen Assigned To 
PrioritynormalSeverityEditorialTypeEnhancement Request
Status ClosedResolutionAccepted As Marked 
NameSteffen Nurpmeso
Organization
User Reference
SectionVol. 3: Shell and Utilities, at, batch
Page Number2479, 2523
Line Number79636 ff., 81458 ff.
Interp Status---
Final Accepted Text0001368:0005168
Summary0001368: Unworldly use of redirection and mailx(1) in at(1) and batch(1) examples.
DescriptionThe sequence

 at now + 1 hour <<!
 diff file1 file2 2>&1 >outfile | mailx mygroup
 !

(likewise for batch(1)) sends out a possibly empty message to the work group "mygroup", which is a very low quality example that seems unworldly.
Desired ActionIf the -E option of mailx(1) becomes standardized (as requested in issue #1367) the above could become wonderful examples for the power of the *X shell environment, and simply be changed to

 at now + 1 hour <<!
 diff file1 file2 2>&1 >outfile | mailx -E mygroup
 !

(likewise for batch(1)). Otherwise change

 at now + 1 hour <<!
 diff file1 file2 2>&1 >outfile | mailx -E mygroup
 !

to

 2. This sequence, which demonstrates redirecting standard error to a pipe, and carefully avoiding of false conditional status codes, is useful in a command procedure (the sequence of output redirection specifications is significant),

 at now + 1 hour <<!
 exec >errfile
 diff file1 file2 2>&1 >outfile
 if [ -s errfile ]; then
   < errfile mailx mygroup
 fi
 !
Tagsissue8

Relationships

related to 0001367 Closed mailx: add -E option to discard (not send) empty messages 

Activities

rhansen

2020-12-14 16:43

manager   bugnote:0005168

Last edited: 2021-01-14 16:43

After applying the changes from 0001347 make the following changes:

On page 2479 lines 79638-79640 (XCU at EXAMPLES) change:
at now + 1 hour <<!
diff file1 file2 2>&1 >outfile | mailx mygroup
!
to:
at now + 1 hour <<EOF
diff file1 file2 2>&1 >outfile | mailx -s "outfile update" mygroup
EOF
Note that this always sends mail when there has been an attempt to update outfile and the body of the message will be empty unless an error occurred.

3. The following shows how to capture both standard error and standard output:
at now + 1 hour <<EOF
{
    run-batch-procesing |
        mailx -s "batch processing output" mygroup
} 2>&1 | mailx -E -s "errors during batch processing" mygroup
EOF
and renumber the later examples.

On page 2523 lines 81460-81462 (XCU batch EXAMPLES) change:
batch <<!
diff file1 file2 2>&1 >outfile | mailx mygroup
!
to:
batch <<EOF
diff file1 file2 2>&1 >outfile | mailx -s "outfile update" mygroup
EOF
Note that this always sends mail when there has been an attempt to update outfile and the body of the message will be empty unless an error occurred.

3. The following shows how to capture both standard error and standard output:
batch <<EOF
{
    run-batch-procesing |
        mailx -s "batch processing output" mygroup
} 2>&1 | mailx -E -s "errors during batch processing" mygroup
EOF


rhansen

2021-01-14 16:46

manager   bugnote:0005201

0001368:0005168 was updated to address feedback sent to the mailing list:

https://www.mail-archive.com/austin-group-l@opengroup.org/msg07304.html

Issue History

Date Modified Username Field Change
2020-07-08 23:10 steffen New Issue
2020-07-08 23:10 steffen Name => Steffen Nurpmeso
2020-07-08 23:10 steffen Section => Vol. 3: Shell and Utilities, at, batch
2020-07-08 23:10 steffen Page Number => 2479, 2523
2020-07-08 23:10 steffen Line Number => 79636 ff., 81458 ff.
2020-07-09 08:02 geoffclare Relationship added related to 0001367
2020-12-14 16:43 rhansen Note Added: 0005168
2020-12-14 16:44 rhansen Note Edited: 0005168
2020-12-14 16:46 rhansen Note Edited: 0005168
2020-12-14 16:47 rhansen Tag Attached: issue8
2020-12-14 16:48 rhansen Interp Status => ---
2020-12-14 16:48 rhansen Final Accepted Text => 0001368:0005168
2020-12-14 16:48 rhansen Status New => Resolved
2020-12-14 16:48 rhansen Resolution Open => Accepted As Marked
2021-01-14 16:43 rhansen Note Edited: 0005168
2021-01-14 16:46 rhansen Note Added: 0005201
2021-01-29 11:32 geoffclare Status Resolved => Applied
2024-06-11 09:08 agadmin Status Applied => Closed