Austin Group Defect Tracker

Aardvark Mark IV


Viewing Issue Simple Details Jump to Notes ] Issue History ] Print ]
ID Category Severity Type Date Submitted Last Update
0001368 [1003.1(2016/18)/Issue7+TC2] Shell and Utilities Editorial Enhancement Request 2020-07-08 23:10 2021-01-29 11:32
Reporter steffen View Status public  
Assigned To
Priority normal Resolution Accepted As Marked  
Status Applied  
Name Steffen Nurpmeso
Organization
User Reference
Section Vol. 3: Shell and Utilities, at, batch
Page Number 2479, 2523
Line Number 79636 ff., 81458 ff.
Interp Status ---
Final Accepted Text Note: 0005168
Summary 0001368: Unworldly use of redirection and mailx(1) in at(1) and batch(1) examples.
Description The 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 Action If 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
 !
Tags issue8
Attached Files

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

-  Notes
(0005168)
rhansen (manager)
2020-12-14 16:43
edited on: 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


(0005201)
rhansen (manager)
2021-01-14 16:46

Note: 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 => Note: 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


Mantis 1.1.6[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker