"Notes" "ubuntu" Mint personal shell style script

Source: Internet
Author: User

Alias LL = 'LS-al'

Use_color = false

# Set colorful PS1 only on colorful terminals.
# Dircolors -- print-database uses its own built-in Database
# Instead of using/etc/dir_colors. Try to use the external file
# First to take advantage of user additions. Use internal bash
# Globbing instead of external grep binary.
Safe_term =$ {term/[^ [: alnum:]/?} # Sanitize term
Match_lhs = ""
[[-F ~ /. Dir_colors] & match_lhs = "$ {match_lhs }$ (<~ /. Dir_colors )"
[[-F/etc/dir_colors] & match_lhs = "$ {match_lhs }$ (</etc/dir_colors )"
[[-Z $ {match_lhs}] \
& Type-P dircolors>/dev/null \
& Match_lhs = $ (dircolors -- print-database)
[[$ '\ N' $ {match_lhs }=* $' \ N' "term" $ {safe_term} *] & use_color = true

If $ {use_color}; then
# Enable colors for LS, etc. Prefer ~ /. Dir_colors #64489
If type-P dircolors>/dev/NULL; then
If [[-f ~ /. Dir_colors]; then
Eval $ (dircolors-B ~ /. Dir_colors)
Elif [[-F/etc/dir_colors]; then
Eval $ (dircolors-B/etc/dir_colors)
Else
Eval $ (dircolors)
Fi
Fi

If [[$ {EUID} = 0]; then
PS1 = '$ {debian_chroot: + ($ debian_chroot)} \ [\ 033 [01; 31m \] \ H \ [\ 033 [01; 34m \] \ W \ $ \ [\ 033 [00m \]'
Else
PS1 = '$ {debian_chroot: + ($ debian_chroot)} \ [\ 033 [01; 32m \] \ [email protected] \ H \ [\ 033 [01; 34m \] \ W \ $ \ [\ 033 [00m \]'
Fi

Alias ls = 'ls -- color = auto'
Alias grep = 'grep -- color = auto'
Else
If [[$ {EUID} = 0]; then
# Show [email protected] When we don't have colors
PS1 = '\ [email protected] \ H \ W \ $'
Else
PS1 = '\ [email protected] \ H \ W \ $'
Fi
Fi

Related Article

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.