简体   繁体   中英

Cat the contents of a .txt file to .bash_profile

I am setting up a .txt file on my dropbox which will auto-sync between my laptop and desktop. This .txt file contains all of contents of a .bash_profile that I want to keep in sync between these computers, including an alias that currently looks like this:

Profile configuration

alias bprofud="cat ~/Dropbox/profile.txt > ~/.bash_profle"

(where "bprofud" == a short name for bash profile update)

The idea here is that in order to keep any changes to my bash profile on either computer, I will simply have to edit the text file in my dropbox and then run "bprofud" on each machine.

This doesn't work though. And I am not sure why. It simply writes a new .bash_profile each time instead of overwriting the previous one.

I am running the latest version of MacOSX.

Any idea what might be going wrong?

The reason is a simple typo failure ;)

alias bprofud="cat ~/Dropbox/profile.txt > ~/.bash_profle"

should be

alias bprofud="cat ~/Dropbox/profile.txt > ~/.bash_profile"

you simply missed the "i"

您可以简单地将您的个人资料来源作为该保管箱文件:

[[ -r ~/Dropbox/profile.txt ]] && . ~/Dropbox/profile.txt

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