Use:
Give the next server administrator some indication that they can manage the server. I was prompted to do the CD, but I don't know how to use the child shell to control the parent shell's directory. But now it's better to know more about the directory than the CD command, when using LS.
Operation Steps:
1, create the directory ~/bin
2. Create File ~/bin/tipls
#!/bin/bash
#
# LS display directory hint text
# requires a. dirtip file in the directory
# root@upall.cn
# 2015-03-26 11:52:56
#
LS $*--color=auto
Cur_dir= $PWD
For i in $*; Todo
Letter=${i:0:1}
If ["$LETTER"!= "-"]; Then
Cur_dir= $i
Break
Fi
Done
tip_file= $CUR _dir "/.dirtip"
If [-E "$TIP _file"]; Then
Echo-e "\e[0;36m\c"
Cat $TIP _file
Echo-e "\e[0m\c"
Fi
3. Set ~/bin/tipls as executable:
1
chmod u+x ~/bin/tipls
4, modify ~/.BASHRC Add a line below:
1
Alias ls= ' Tipls '
5. Enter the directory where you want to display the message, create the. dirtip file, and enter the text you want to prompt
6. Log in again after logging off
7. Complete
--End--
color.sh
#/bin/bash
For STYLE in 0 1 2 3 4 5 6 7; Todo
For FG in 30 31 32 33 34 35 36 37; Todo
For BG in 40 41 42 43 44 45 46 47; Todo
Ctrl= "\033[${style};${fg};${bg}m"
Echo-en "${ctrl}"
Echo-n "${STYLE};${FG};${BG}"
Echo-en "\033[0m"
Done
Echo
Done
Echo
Done
# Reset
Echo-e "\033[0m"
Echo-e "\033[0m"
Echo-e "\033[0m" and Echo-e "\e[0m" have the same effect, two ways to type a command