简体   繁体   中英

Remove ".bash_aliases" with bash script

In my .bashrc I'm using .sh script for easily configuring newly installed Debian. But while trying to

rm -f ~/.bash_aliases
wget https://raw.githubusercontent.com/.../.bash_aliases

rm -f ~/.bashrc
wget https://raw.githubusercontent.com/.../.bashrc

it's just omitting those line? File is with permission chmod +x ./script.sh and run by sudo ./script.sh What could possibly be wrong?

(In final code there is full link, files are being downloaded as .bashrc.1 and .bash_aliases.1 )

Don't use sudo unless you have a good reason.

When you run sudo ./script.sh it runs as root, so ~ refers to root's home directory /root instead of your user's home directory.

Just run ./script.sh instead, so that it runs as you and modifies your own home directory.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM