Linux under the LS command when displaying the contents of the text and other related hints

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.