源从一个.bash_profile文件目录下的所有文件 [英] source all files in a directory from .bash_profile
本文介绍了源从一个.bash_profile文件目录下的所有文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要允许多个应用程序追加到一个系统变量(在此情况下,$ PYTHONPATH)。我想指定的目录中的每个应用程序可以添加一个模块(例如.bash_profile_modulename)的。尝试过这样的事情在〜/ .bash_profile中:
I need to allow several applications to append to a system variable ($PYTHONPATH in this case). I'm thinking of designating a directory where each app can add a module (e.g. .bash_profile_modulename). Tried something like this in ~/.bash_profile:
find /home/mike/ -name ".bash_profile_*" | while read FILE; do
source "$FILE"
done;
,但它不会出现工作
but it doesn't appear to work.
在此先感谢,如果你能提供一个补丁或任何可行的解决方案。
Thanks in advance if you can offer a fix or any working solution.
-Mike
推荐答案
岂不
for f in ~/.bash_profile_*; do source $f; done
就足够了?
的修改的: LS的附加层〜/ .bash _ *
简化为直接庆典通配
Edit: Extra layer of ls ~/.bash_*
simplified to direct bash globbing.
这篇关于源从一个.bash_profile文件目录下的所有文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文