我的所有软件,客户化的脚本和资料都存放在我的一个NTFS逻辑盘。
work
----> working
---->material
---->system
----->profile
---->software
----->*
----->profile
每次启动Ubuntu, 首先加载这个NTFS盘到/media/work, 添加这行代码到/etc/fstab,
/dev/sda5 /media/work ntfs iocharset=utf8,umask=000 0 0
然后,建立一个链接/working -> /media/work/working.
ls -s /media/work/working /working
在/home/robert目录里面的.bashrc里面添加如下,
#Init the Working Folder
source /working/system/profile
source /working/system/profile
这将调用初始化脚本/working/system/profile. /working/system/profile设置一些别名和参数后会调用/working/software/*/profile来提供给不同的软件初始化他们自己。
#!/bin/bash
#Init My Shells
PATH=$PATH:/working/system/utilities
#Init Alias
alias l="ls -l"
alias ll="ls -l"
alias lm="ls -l | more"
alias c="clear"
alias e="cd .."
alias e2="cd ../../"
alias e3="cd ../../../"
alias e4="cd ../../../../"
alias e5="cd ../../../../../"
alias e6="cd ../../../../../../"
alias e7="cd ../../../../../../../"
alias e8="cd ../../../../../../../../"
alias e9="cd ../../../../../../../../../"
alias fg1="fg %1"
alias fg2="fg %2"
alias fg3="fg %3"
alias fg4="fg %4"
alias fg5="fg %5"
alias bg1="bg %1"
alias bg2="bg %2"
alias bg3="bg %3"
alias bg4="bg %4"
alias bg5="bg %5"
alias eh="cd ~"
alias er="cd /"
alias cdw="cd /working"
alias cdm="cd /working/material"
alias cdy="cd /working/system"
alias cdu="cd /working/system/utilities"
alias cds="cd /working/software"
#Init Miscelaneous
export AWT_TOOLKIT=MToolkit
set -o vi
#Init Child Folder
setup()
{
for child in ${1}/*
do
childProfile="$child/profile"
#echo "Start to init child folder $childProfile"
if [ -x "$childProfile" ]
then
#echo "Start to source $childProfile"
source "$childProfile"
fi
done
}
for software in /working/software*
do
[ -d "$software" ] && setup $software
done
#Init Oracle DB Parameter
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=/opt/oracle/product/11.1.0/db_1
export ORACLE_SID=orcl
export ORACLE_ORA=/opt/oracle/product/11.1.0/db_1/network/admin
export PATH=$PATH:/opt/oracle/product/11.1.0/db_1/bin
export EDITOR=/usr/bin/vim
#Init My Shells
PATH=$PATH:/working/system/utilities
#Init Alias
alias l="ls -l"
alias ll="ls -l"
alias lm="ls -l | more"
alias c="clear"
alias e="cd .."
alias e2="cd ../../"
alias e3="cd ../../../"
alias e4="cd ../../../../"
alias e5="cd ../../../../../"
alias e6="cd ../../../../../../"
alias e7="cd ../../../../../../../"
alias e8="cd ../../../../../../../../"
alias e9="cd ../../../../../../../../../"
alias fg1="fg %1"
alias fg2="fg %2"
alias fg3="fg %3"
alias fg4="fg %4"
alias fg5="fg %5"
alias bg1="bg %1"
alias bg2="bg %2"
alias bg3="bg %3"
alias bg4="bg %4"
alias bg5="bg %5"
alias eh="cd ~"
alias er="cd /"
alias cdw="cd /working"
alias cdm="cd /working/material"
alias cdy="cd /working/system"
alias cdu="cd /working/system/utilities"
alias cds="cd /working/software"
#Init Miscelaneous
export AWT_TOOLKIT=MToolkit
set -o vi
#Init Child Folder
setup()
{
for child in ${1}/*
do
childProfile="$child/profile"
#echo "Start to init child folder $childProfile"
if [ -x "$childProfile" ]
then
#echo "Start to source $childProfile"
source "$childProfile"
fi
done
}
for software in /working/software*
do
[ -d "$software" ] && setup $software
done
#Init Oracle DB Parameter
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=/opt/oracle/product/11.1.0/db_1
export ORACLE_SID=orcl
export ORACLE_ORA=/opt/oracle/product/11.1.0/db_1/network/admin
export PATH=$PATH:/opt/oracle/product/11.1.0/db_1/bin
export EDITOR=/usr/bin/vim
转载于:https://blog.51cto.com/robertleepeak/196998