memo
変態xargs
```bash
function test() {
xarg1="$1"
xarg2="$2"
echo $xarg1 $xarg2
}
export -f test
cat linetxt | xargs -I {} bash -c 'test aa bb'
```
memo
変態xargs
```bash
function test() {
xarg1="$1"
xarg2="$2"
echo $xarg1 $xarg2
}
export -f test
cat linetxt | xargs -I {} bash -c 'test aa bb'
```
xargsに渡したあとにコマンドに渡したいときのエラー表示がこれで柔軟に対応できるし、スタックトレースも表示できる
index=1
while frame=($(caller "${index}")); do
((index++))
# at function <function name> (<file name>:<line no>)
echo "at function ${frame[1]} (${frame[2]}:${frame[0]})" >&2
done
@froggie3 ただ気持ち悪いxargsの使い方なだけやで
@froggie3 厳密に言えば間違えた
bash -c ’test {} aaa ’
でこのtest関数内で失敗の戻り値は別で返せるのとだいぶ柔軟にxargsつかえるというだけや
076萌SNS is a social network, courtesy of 076. It runs on GNU social, version 2.0.2-beta0, available under the GNU Affero General Public License.
All 076萌SNS content and data are available under the Creative Commons Attribution 3.0 license.