|
From: | anonymous |
Subject: | [bug #61009] xargs need option to immediately stop on command fail |
Date: | Wed, 4 Aug 2021 04:50:40 -0400 (EDT) |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0 |
URL: <https://savannah.gnu.org/bugs/?61009> Summary: xargs need option to immediately stop on command fail Project: findutils Submitted by: None Submitted on: Wed 04 Aug 2021 08:50:38 AM UTC Category: xargs Severity: 3 - Normal Item Group: None Status: None Privacy: Public Assigned to: None Originator Name: Originator Email: lego12239@yandex.ru Open/Closed: Open Release: None Discussion Lock: Any Fixed Release: None _______________________________________________________ Details: Hello. If we want xargs stop on command fail we need to do the next complex construct with sh: xargs -IX -n1 sh -c "cp -f X $IMGDIR_DST/X || exit 255" instead of simply: xargs -F -IX -n1 cp -f X $IMGDIR_DST/X (imagine the -F turns on stop on command fail). This is simpler and less error prone. Thus, we can do in our scripts: find . -type f | xargs -F -IX -n1 cp -f X $IMGDIR_DST/X || exit 1 Instead of more complex and error prone: find . -type f | xargs -IX -n1 sh -c "cp -f X $IMGDIR_DST/X || exit 255" || exit 1 _______________________________________________________ Reply to this item at: <https://savannah.gnu.org/bugs/?61009> _______________________________________________ Message sent via Savannah https://savannah.gnu.org/
[Prev in Thread] | Current Thread | [Next in Thread] |