[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
noclobber and redirected group command
From: |
chris |
Subject: |
noclobber and redirected group command |
Date: |
Tue, 10 Aug 2021 10:34:31 +1000 (AEST) |
Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -g -O2 -fdebug-prefix-map=/build/bash-a6qmCk/bash-5.0=.
-fstack-protector-strong -Wformat -Werror=format-security -Wall
-Wno-parentheses -Wno-format-security
uname output: Linux athena 5.4.0-65-generic #73-Ubuntu SMP Mon Jan 18 17:25:17
UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu
Bash Version: 5.0
Patch Level: 17
Release Status: release
Description:
When using errexit and noclobber, a group command redirected to
overwrite an existing file should cause script termination but doesn't.
Repeat-By:
----------------------------------------------------------------------
#!/bin/bash
#
# Why can we get "here" but not "there"?
#
shopt -s -o errexit noclobber
touch /tmp/test.out
{ echo a; } > /tmp/test.out
echo here
echo a > /tmp/test.out
echo there
----------------------------------------------------------------------
- noclobber and redirected group command,
chris <=