ohmybash / oh-my-bash

A delightful community-driven framework for managing your bash configuration, and an auto-update tool so that makes it easy to keep up with the latest updates from the community.
https://ohmybash.github.io
MIT License
5.55k stars 626 forks source link

Title: Bash script with '>' redirection exits with error when overwriting existing file #453

Open ZakariaElbouzkri opened 12 months ago

ZakariaElbouzkri commented 12 months ago

Description: When working with the '>' redirection operator in the Oh-My-Bash extension if you provide a filename that already exists, the script exits with the following error message: bash: examplefile: can overwrite existing file

KoCoder commented 9 months ago

Hello, oh-my-bash by default noclobber in the bash use >| as a workarround or go into your local oh-my-bash installation and comment the following line out. https://github.com/ohmybash/oh-my-bash/blob/24bd7e71ad7a8c51eaeff001439a266daf992e3a/lib/shopt.sh#L9

Or you could just execute this set +o noclobber to disable (toggle) noclobber for the current session.