set -o noclobberhelp set
-C If set, disallow existing regular files to be overwritten
by redirection of output.
$ echo "salam
1
2
3
dorood
a b c d
">file.txt
> file.txt
$ echo "salam
1
2
3
dorood
a b c d
">file.txt
$ set -o noclobber
$ > file.txt
bash: file.txt: cannot overwrite existing file
set +o noclobberecho "hello" >| file.txt
$ alias
alias als='vim ~/.bash_aliases'
alias autodir='printf "\e[?2501h"'
alias ctrlc='xclip -selection c'
alias ctrlv='xclip -selection c -o'
alias dn='aria2c -s16 -x16 -j4 -c'
alias em='emacs -nw'
alias fls='/bin/ls -1U'
alias gh='cd ~/dev/github/'
alias is_tor='curl -x socks5h://127.0.0.1:9050 -s https://check.torproject.org/api/ip | jq ".IsTor"'
alias ll='ls -ltrh'
alias ls='ls --color=auto'
alias noautodir='printf "\e[?2501l"'
alias now='date '\''+%Y_%m_%d'\'''
alias now_j='jdate '\''+%Y_%m_%d'\'''
alias upaste='nc -N paste.ubuntu-ir.org 1337'
alias alias=ls
$ echo "salam
1
2
3
dorood
a b c d
">file.txt
$ cat file.txt | grep a --color
salam
a b c d
$ cat file.txt | grep a --color >file.txt
$ cat file.txt
$ sudo apt install moreutils
$ cat file.txt | grep a --color | sponge file.txt
$ cat file.txt
salam
a b c d