一、在linux中的etc/profile中
export PATH=/bin:/sbin:/usr/bin:/usr/sbin
if [ "$PS1" ]; then
if [ "`id -u`" -eq 0 ]; then
export PS1='# '
else
export PS1='$ '
fi
fi
export PAGER='/bin/more'
export EDITOR='/bin/vi'
# Source configuration files from /etc/profile.d
for i in /etc/profile.d/*.sh ; do
if [ -r "$i" ]; then
. $i
fi
done
#qt
export QT_ROOT=/usr/lib/qt
export QT_QPA_GENERIC_PLUGINS=tslib:/dev/input/event1
export QT_QPA_EVDEV_TOUCHSCREEN_PARAMTERS=/dev/input/event1
export QT_QPA_FONTDIR=/usr/share/fonts
export QT_QPA_PLATFORM_PLUGIN_PATH=$QT_ROOT/plugins
export QT_QPA_PLATFORM=linuxfb:tty=/dev/fb0
export QT_PLUGIN_PATH=$QT_ROOT/plugins
export QT_QPA_FB_TSLIB=1
export LD_LIBRARY_PATH=$QT_ROOT/lib:$QT_ROOT/plugins/platforms
export QT_QPA_EGLFS_TSLIB=1
export XDG_RUNTIME_DIR=/usr/lib/a
export RUNLEVEL=3
#tslib
export TSLIB_ROOT=/usr/lib/ts
export TSLIB_CONSOLEDEVICE=none
export TSLIB_FBDEVICE=/dev/fb0
export TSLIB_TSDEVICE=/dev/input/event1
export TSLIB_CONFFILE=/etc/ts.conf
export TSLIB_PLUGINDIR=/usr/lib/ts
export TSLIB_CALIBFILE=/etc/pointercal
export LD_PRELOAD=/usr/lib/libts.so
unset i
export QT_QPA_PLATFORM=linuxfb:fb=/dev/fb0
export QT_QPA_FONTDIR=/usr/lib/fonts
HOSTNAM='/bin/hostname:'
PS1='\[\e[0;32m\][\u@\h:\w]\$ \[\e[m\]'
shopt -s checkwinsize
resize
export PS1 HOSTNAME
1.导出基本路径 - 设置基本的命令搜索路径。
export PATH=/bin:/sbin:/usr/bin:/usr/sbin
2.设置提示符 - 如果存在命令提示符变量PS1
,则根据用户是否为root用户(用户ID为0),设置不同的命令提示符。
if [ "$PS1" ]; then
if [ "`id -u`" -eq 0 ]; then
export PS1='# '
else
export PS1='$ '
fi
fi
3设置默认的分页器和编辑器 - 分别将more和vi设置为默认的文本分页器和文本编辑器。
export PAGER='/bin/more'
export EDITOR='/bin/vi'
4. 导入/etc/profile.d目录下的配置文件 - 执行/etc/profile.d目录下所有可读的.sh脚本文件。
for i in /etc/profile.d/*.sh ; do
if [ -r "$i" ]; then
. $i
fi
done
5.设置Qt环境变量 - 配置Qt应用程序的环境变量,以适应Linux帧缓冲和触摸屏输入。
export QT_ROOT=/usr/lib/qt
export QT_QPA_GENERIC_PLUGINS=tslib:/dev/input/event1
export QT_QPA_EVDEV_TOUCHSCREEN_PARAMTERS=/dev/input/event1
export QT_QPA_FONTDIR=/usr/share/fonts
export QT_QPA_PLATFORM_PLUGIN_PATH=$QT_ROOT/plugins
export QT_QPA_PLATFORM=linuxfb:tty=/dev/fb0
export QT_PLUGIN_PATH=$QT_ROOT/plugins
export QT_QPA_FB_TSLIB=1
export LD_LIBRARY_PATH=$QT_ROOT/lib:$QT_ROOT/plugins/platforms
export QT_QPA_EGLFS_TSLIB=1
export XDG_RUNTIME_DIR=/usr/lib/a
export RUNLEVEL=3
6.设置tslib环境变量 - 配置tslib(触摸屏库)的环境变量。
export TSLIB_ROOT=/usr/lib/ts
export TSLIB_CONSOLEDEVICE=none
export TSLIB_FBDEVICE=/dev/fb0
export TSLIB_TSDEVICE=/dev/input/event1
export TSLIB_CONFFILE=/etc/ts.conf
export TSLIB_PLUGINDIR=/usr/lib/ts
export TSLIB_CALIBFILE=/etc/pointercal
export LD_PRELOAD=/usr/lib/libts.so
7.其他设置 - 其他一些环境变量和Shell选项的设置。
export QT_QPA_PLATFORM=linuxfb:fb=/dev/fb0
export QT_QPA_FONTDIR=/usr/lib/fonts
HOSTNAM='/bin/hostname:'
PS1='\[\e[0;32m\][\u@\h:\w]\$ \[\e[m\]'
shopt -s checkwinsize
resize
export PS1 HOSTNAME