[贴图]我的bash嘿嘿

桌面秀,不同桌面、不同风格。
回复
头像
huabinwu
帖子: 68
注册时间: 2008-08-15 14:38
送出感谢: 0
接收感谢: 0

[贴图]我的bash嘿嘿

#1

帖子 huabinwu » 2008-09-15 23:16

修改了下别人的code。呵呵,是不是颜色太花了点。 大家也把自己的.bashrc 贴出来看看撒。

代码: 全选

# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples

# If not running interactively, don't do anything
[ -z "$PS1" ] && return

# don't put duplicate lines in the history. See bash(1) for more options
export HISTCONTROL=ignoredups
# ... and ignore same sucessive entries.
export HISTCONTROL=ignoreboth

# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize

# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"

# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
    debian_chroot=$(cat /etc/debian_chroot)
fi

# enable color support of ls and also add handy aliases
if [ "$TERM" != "dumb" ] && [ -x /usr/bin/dircolors ]; then
    eval "`dircolors -b`"
    alias ls='ls --color=auto'
    alias dir='ls --color=auto --format=vertical'
    alias vdir='ls --color=auto --format=long'

    alias grep='grep --color=auto'
    alias fgrep='fgrep --color=auto'
    alias egrep='egrep --color=auto'
fi

# some more ls aliases
alias ll='ls -l'
alias la='ls -A'
alias l='ls -CF'

# user-defined aliases
alias rm='rm -vi'
alias cp='cp -vi'
alias mv='mv -vi'
alias clean='rm -f "#"* "."*~ *~ *.bak *.dvi *.aux *.log'

# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if [ -f /etc/bash_completion ]; then
    . /etc/bash_completion
fi

#========================================================
# Define a few Colours
BLACK='\e[0;30m'
BLUE='\e[0;34m'
GREEN='\e[0;32m'
CYAN='\e[0;36m'
RED='\e[0;31m'
PURPLE='\e[0;35m'
BROWN='\e[0;33m'
LIGHTGRAY='\e[0;37m'
DARKGRAY='\e[1;30m'
LIGHTBLUE='\e[1;34m'
LIGHTGREEN='\e[1;32m'
LIGHTCYAN='\e[1;36m'
LIGHTRED='\e[1;31m'
LIGHTPURPLE='\e[1;35m'
YELLOW='\e[1;33m'
WHITE='\e[1;37m'
NC='\e[0m'              # No Color

# WELCOME SCREEN
clear
echo -e "${GREEN}" "       ==================================================";
echo -e "${LIGHTRED}" "              Hello, $USER. Manage your time!";
echo -e "${GREEN}" "       ==================================================";
echo -ne "${LIGHTBLUE}" ; ddate;
echo -ne "${WHITE}" ; cal ; 
echo -ne "${LIGHTCYAN}";fortune;
echo ;
#========================================================

# Functions
extract () {
	if [ -f $1 ] ; then
		case $1 in
			*.tar.bz2)	tar xjf $1		;;
			*.tar.gz)	tar xzf $1		;;
			*.bz2)		bunzip2 $1		;;
			*.rar)		rar x $1		;;
			*.gz)		gunzip $1		;;
			*.tar)		tar xf $1		;;
			*.tbz2)		tar xjf $1		;;
			*.tgz)		tar xzf $1		;;
			*.zip)		unzip $1		;;
			*.Z)		uncompress $1	;;
			*)		echo "'$1' cannot be extracted via extract()" ;;
		esac
	else
		echo "'$1' is not a valid file"
	fi
}

# Function for setting a fancy prompt.
# Original author Christopher Roy Bratusek (http://www.nanolx.org)
# Last modified by huabinwu 2008-09-14
function pre_prompt {
newPWD="${PWD}"
user="whoami"
host=$(echo -n $HOSTNAME | sed -e "s/[\.].*//")
datenow=$(date "+%a, %d %b %y")
let promptsize=$(echo -n "--<$user@$host>---<${PWD}>---" \
                 | wc -c | tr -d " ")
let fillsize=${COLUMNS}-${promptsize}
fill=""
while [ "$fillsize" -gt "0" ] 
do 
    fill="${fill}—"
	let fillsize=${fillsize}-1
done
if [ "$fillsize" -lt "0" ]
then
    let cutt=3-${fillsize}
    newPWD="...$(echo -n $PWD | sed -e "s/\(^.\{$cutt\}\)\(.*\)/\2/")"
fi

}

PROMPT_COMMAND=pre_prompt

export black="\[\033[0;38;5;0m\]"
export red="\[\033[0;38;5;1m\]"
export green="\[\033[0;38;5;2m\]"
export yellow="\[\033[0;38;5;3m\]"
export blue="\[\033[0;38;5;4m\]"
export magenta="\[\033[0;38;5;55m\]"
export cyan="\[\033[0;38;5;6m\]"
export white="\[\033[0;38;5;7m\]"
export coldblue="\[\033[0;38;5;33m\]"
export smoothblue="\[\033[0;38;5;111m\]"
export iceblue="\[\033[0;38;5;45m\]"
export turqoise="\[\033[0;38;5;50m\]"
export smoothgreen="\[\033[0;38;5;42m\]"

PS1="$green╔─╢$coldblue\u@\h$green╟─\${fill}─┤$BLUE\$newPWD\
$green├────│\n$green╚─┤$turqoise\$(date \"+%H:%M\") \$$green├→$smoothgreen " 
附件
terminal.png
头像
ebok
帖子: 852
注册时间: 2008-02-15 0:09
送出感谢: 0
接收感谢: 0

#2

帖子 ebok » 2008-09-15 23:43

屏幕小,显示那么多东西浪费版面,我还是用最简单的。
Somebody think they are full of niubility, so they play a zhuangbility, but only reflect their shability.
头像
kofshower
帖子: 1343
注册时间: 2007-03-13 11:23
送出感谢: 0
接收感谢: 0
联系:

#3

帖子 kofshower » 2008-09-16 0:10

呵呵。
PS1="$green╔─╢$coldblue\u@\h$green╟─\${fill}─┤$BLUE\$newPWD\
$green├────│\n$green╚─┤$turqoise\$(date \"+%H:%M\") \$$green├→$smoothgreen "
颜色直接从$LS_COLORS取~我不用bash的
"We are all in the mud, but some of us are looking at the stars." (Oscar Wilde)
We are not born for ourselves.
人生天地间,并非为自己
Homepage:http://sites.google.com/site/polarisnotme/
头像
huabinwu
帖子: 68
注册时间: 2008-08-15 14:38
送出感谢: 0
接收感谢: 0

#4

帖子 huabinwu » 2008-09-16 10:54

kofshower 写了:呵呵。
PS1="$green╔─╢$coldblue\u@\h$green╟─\${fill}─┤$BLUE\$newPWD\
$green├────│\n$green╚─┤$turqoise\$(date "+%H:%M") \$$green├→$smoothgreen "
颜色直接从$LS_COLORS取~我不用bash的
:em01 3ks。又学了一招。。。
头像
adagio
论坛版主
帖子: 22110
注册时间: 2008-02-17 23:47
来自: 美丽富饶的那啥星球
送出感谢: 7 次
接收感谢: 74 次

Re: [贴图]我的bash嘿嘿

#5

帖子 adagio » 2008-10-08 22:35

抄一个玩
明天就换大三八!
——8核CPU、8G内存、8T硬盘……
8卡交火,80寸大屏放8个……
IPv8的光纤要8条……

---------------------------------------------------------------------------------
[图片版]新手当自强(续)FAQ
[新手进阶]挂载、fstab、调整linux分区
[图片版]E17桌面环境配置手把手
头像
yjcong
帖子: 2470
注册时间: 2006-02-28 3:11
送出感谢: 0
接收感谢: 0

Re: [贴图]我的bash嘿嘿

#6

帖子 yjcong » 2008-10-09 2:44

adagio 写了:抄一个玩
阿姨早就搞过这种东西了, 你怎么没留意呢??
一梦三年,
松风依旧,
萝月何曾老.


灵幽听微, 谁观玉颜?
灼灼春华, 绿叶含丹.
头像
adagio
论坛版主
帖子: 22110
注册时间: 2008-02-17 23:47
来自: 美丽富饶的那啥星球
送出感谢: 7 次
接收感谢: 74 次

Re: [贴图]我的bash嘿嘿

#7

帖子 adagio » 2008-10-09 20:41

没看见啊,给个链接呵呵
明天就换大三八!
——8核CPU、8G内存、8T硬盘……
8卡交火,80寸大屏放8个……
IPv8的光纤要8条……

---------------------------------------------------------------------------------
[图片版]新手当自强(续)FAQ
[新手进阶]挂载、fstab、调整linux分区
[图片版]E17桌面环境配置手把手
头像
yjcong
帖子: 2470
注册时间: 2006-02-28 3:11
送出感谢: 0
接收感谢: 0

Re: [贴图]我的bash嘿嘿

#8

帖子 yjcong » 2008-10-09 23:13

adagio 写了:没看见啊,给个链接呵呵
viewtopic.php?t=65081&highlight=

viewtopic.php?t=79068&highlight=
一梦三年,
松风依旧,
萝月何曾老.


灵幽听微, 谁观玉颜?
灼灼春华, 绿叶含丹.
头像
adagio
论坛版主
帖子: 22110
注册时间: 2008-02-17 23:47
来自: 美丽富饶的那啥星球
送出感谢: 7 次
接收感谢: 74 次

Re: [贴图]我的bash嘿嘿

#9

帖子 adagio » 2008-10-10 10:36

多谢晕!
明天就换大三八!
——8核CPU、8G内存、8T硬盘……
8卡交火,80寸大屏放8个……
IPv8的光纤要8条……

---------------------------------------------------------------------------------
[图片版]新手当自强(续)FAQ
[新手进阶]挂载、fstab、调整linux分区
[图片版]E17桌面环境配置手把手
头像
xiooli
帖子: 6956
注册时间: 2007-11-19 21:51
来自: 成都
送出感谢: 0
接收感谢: 3 次
联系:

Re: [贴图]我的bash嘿嘿

#10

帖子 xiooli » 2009-05-20 21:07

我的:
5.png

代码: 全选

# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)         
# for examples                                                                     

# If not running interactively, don't do anything
[ -z "$PS1" ] && return                          

# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.                    
shopt -s checkwinsize                                        

# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"       

# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then               
    debian_chroot=$(cat /etc/debian_chroot)                                 
fi                                                                          

# enable color support of ls and also add handy aliases
if [ "$TERM" != "dumb" ] && [ -x /usr/bin/dircolors ]; then
    eval "`dircolors -b`"                                  
    alias ls='ls --color=auto'                             
    alias dir='ls --color=auto --format=vertical'          
    alias vdir='ls --color=auto --format=long'             
    alias grep='grep --color=auto'                         
    alias fgrep='fgrep --color=auto'                       
    alias egrep='egrep --color=auto'                       
fi                                                         

# some more ls aliases
alias ll='ls -l'      
alias la='ls -A'      
alias l='ls -CF'      

# user-defined aliases
#alias rm='rm -vi'    
#alias cp='cp -vi'    
#alias mv='mv -vi'    
alias clean='rm -f "#"* "."*~ *~ *.dvi *.aux *.log'
alias clr='clear'                                  
#alias agi='sudo apt-get install'                  
#alias acs='sudo apt-cache search'                 
alias mna='man'                                    

# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).                                        
if [ -f /etc/bash_completion ]; then                                
    . /etc/bash_completion                                          
fi                                                                  

#自定义函数

x () {  #解压

   if [ -f $1 ] ; then
      case $1 in      
         *.tar.bz2)   tar xjf $1      ;;
         *.tar.gz)   tar xzf $1      ;; 
         *.bz2)      bunzip2 $1      ;; 
         *.rar)      unrar x $1      ;; 
         *.gz)      gunzip $1      ;;   
         *.tar)      tar xf $1      ;;  
         *.tbz2)      tar xjf $1      ;;
         *.tgz)      tar xzf $1      ;; 
         *.zip)      unzip $1      ;;   
         *.Z)      uncompress $1   ;;   
         "")      没有输入文件名!   ;; 
         *)      echo "'$1' 不能通过 x 解压" ;;
      esac                                     
   else                                        
      echo "'$1' 不是有效文件!"               
   fi                                          
}                                              

#pacman 简写。
pm () {       

        if [ "`which powerpill 2>/dev/null`" ]; then
                sudo powerpill $@                   
        else                                        
                sudo pacman $@                      
        fi                                          
}                                                   

#yaourt 简写。
yao () {      

        yaourt $@
}                

#srcpac 简写
sp () {     

        sudo srcpac $@
}                     

pre_prompt () {

    if [ ${changed:-0} -eq 0 ];then
        PS1="${back_green}\u${white}(\w)${back_green}>>${white} "
        changed=1
    else
        PS1="${back_brown}\u${white}(\w)${back_brown}<<${white} "
        changed=0
    fi
}

unset PROMPT_COMMAND
PROMPT_COMMAND=pre_prompt

#sudo completion
complete -cf sudo
头像
yjcong
帖子: 2470
注册时间: 2006-02-28 3:11
送出感谢: 0
接收感谢: 0

Re: [贴图]我的bash嘿嘿

#11

帖子 yjcong » 2009-05-21 1:04

最近很流行挖坟吗?
那我也去挖挖旧东西去 :em05 :em05
一梦三年,
松风依旧,
萝月何曾老.


灵幽听微, 谁观玉颜?
灼灼春华, 绿叶含丹.
头像
jioyo源
帖子: 3476
注册时间: 2008-10-08 13:48
送出感谢: 0
接收感谢: 2 次

Re: [贴图]我的bash嘿嘿

#12

帖子 jioyo源 » 2009-05-21 1:09

:em20 怎么都喜欢这样折腾,那么长,S I T B
--------------------------------------
论坛精华贴全集:http://forum.ubuntu.org.cn/viewtopic.php?f=48&t=199845
book:http://forum.ubuntu.org.cn/viewtopic.php?f=21&t=198286
头像
INUYASHA
帖子: 366
注册时间: 2007-03-16 15:42
送出感谢: 0
接收感谢: 0

Re: [贴图]我的bash嘿嘿

#13

帖子 INUYASHA » 2009-05-23 9:34

LZ终端用的是啥字体呀 蛮漂亮的
回复

回到 “屏幕抓图”