Shell/Bash在线运行

所属目录
点击了解高性能代码运行API
运行结果
教程手册
代码仓库
极速运行
交互输入
极速运行模式,更高效的运行,点击编辑器上方的运行按钮即刻体验吧。
以下是用户最新保存的代码
# 命令替换 有两种方法: - 方法一:`command` - 方法二:$(command) 总结: - ``和$()两者是等价的,但推荐初学者使用$(),易于掌握;缺点是极少数UNIX可能不支持,但``都是支持的 - $(())主要用来进行整数运算,包括加减乘除,引用变量前面可以加$,也可以不加$ 发布于:2023-03-17 21:48 awk的for循环和二维字典和printf实现二维数据表倒置 发布于:2023-03-15 23:34 # 变量替换 ## 字符串处理 ### 字符长度 1. ${#string} 2. `expr length "$string"` ### 获取字符串索引位置 1. expr index "$string" substr ### 获取子串长度 1. expr match "$string" substr ### 抽取子串 方法一: 1. ${string:position} 2. ${string:position:length} 3. ${string: -position} 或者 ${string:(position)} 方法二: 1. expr substr $string $position $length 注意:使用expr,索引计数是从1开始计算;使用${string:position},索引计数是从0开始计数 发布于:2023-03-17 21:33 for 循环用法 发布于:2023-03-15 03:47 测试测试测试测试测试测试测试 发布于:2023-03-14 10:48 #echo,xargs,sort,uniq,awk命令实现word.txt统计word次数 发布于:2023-03-14 10:47 工业互联网日报 发布于:2023-03-06 12:52 初次使用shell测试 发布于:2023-03-04 21:31 while 循环123 发布于:2023-03-01 22:48 检测两台服务器指定目录下的文件一致性 发布于:2023-02-27 21:22 增加新的判断条件并且兼容没有设置过判断参数的项目 发布于:2023-02-24 16:03 REDIS监控 发布于:2023-02-27 09:18 shell脚本1 发布于:2023-02-21 15:08 测试shell 发布于:2023-01-31 09:46 支持库安装 发布于:2022-12-29 12:15 测试软件服务是否安装并确认是否安装 发布于:2022-12-28 14:56 自定义函数 发布于:2022-12-27 10:49 read读取控制台输入 read (选项)(参数) 发布于:2022-12-27 09:14 while循环 while [ 条件判断式 ] do 程序 done 执行结果不对,为啥呢 发布于:2022-12-26 17:49 for循环 语法二 for 变量 in 值1 值2 值3... do 程序 done 发布于:2022-12-26 17:30 for循环 发布于:2022-12-26 17:16 shell脚本测试! 发布于:2022-12-20 17:25 for字符写三行值 发布于:2022-12-19 10:49 求最大值。 发布于:2022-12-19 10:48 Shell 基础知识 发布于:2022-12-06 00:41 【Shell】测试read功能,注意两次的输入要有回车 发布于:2022-12-01 20:15 【Shell】此段代码为shell if else测试代码 发布于:2022-12-01 20:16 the number of dirctary is 13 the number of file is 16 发布于:2022-11-30 00:27 bash-测试表清理 发布于:2022-11-28 18:09 设计一个任意输入一个数,判断这个数是不是质数 发布于:2022-11-26 18:02 shell判断解压 发布于:2022-11-24 16:49 九九乘法表 发布于:2022-11-07 17:39 字符类型判断 发布于:2022-11-07 21:45 12 编写shell脚本,执行后,打印一行提示“Please input a number.”逐次打印用户输入数值,直到用户输入“end”为止。 发布于:2022-10-24 21:42 程序建立三个以输入日期为名称的文件. 发布于:2022-07-12 15:19 用户输入姓氏和名字,系统输出姓名 发布于:2022-07-12 15:01 相隔某数倍数进行打印 发布于:2022-05-25 10:21 工作测试代码 发布于:2022-05-16 14:10 shell基础语法 发布于:2022-04-11 18:29 shell脚本 发布于:2022-01-20 15:56 sssasdfsad asdf asdfa 发布于:2021-10-08 17:10 在线Shell体验 发布于:2021-08-11 09:50 在线shell体验 发布于:2021-08-11 09:45 #输入一个数字,并显示出来。 发布于:2021-08-05 17:05 r_daily_new_clue_d.sh 发布于:2021-07-22 20:34 shell脚本测试 发布于:2021-07-20 20:02 查找局域网内可ssh登录的主机(22端口) 发布于:2021-07-14 18:03 dns setting for macOS 发布于:2021-06-22 14:54 不用date编写计算时间的脚本 发布于:2021-05-23 14:11 第一个shell程序 发布于:2021-05-09 16:12 [更多]
显示目录

dircolors命令-设置 ls 指令色彩



dircolors命令

dircolors命令用于设置 ls 指令在显示目录或文件时所用的色彩。

dircolors可根据[色彩配置文件]来设置LS_COLORS环境变量或是显示设置LS_COLORS环境变量的shell指令。

语法

dircolors [色彩配置文件]

dircolors [-bcp][--help][--version]

参数

-b或--sh或--bourne-shell  显示在Boume shell中,将LS_COLORS设为目前预设置的shell指令。
-c或--csh或--c-shell  显示在C shell中,将LS_COLORS设为目前预设置的shell指令。
-p或--print-database  显示预设置
-help   显示帮助。
-version  显示版本信息。

实例

显示默认值

# dircolors -p //显示默认值
# Configuration file for dircolors, a utility to help you set the
# LS_COLORS environment variable used by GNU ls with the --color option.
# Copyright (C) 1996, 1999-2008
# Free Software Foundation, Inc.
# Copying and distribution of this file, with or without modification,
# are permitted provided the copyright notice and this notice are preserved.
# The keywords COLOR, OPTIONS, and EIGHTBIT (honored by the
# slackware version of dircolors) are recognized but ignored.
# Below, there should be one TERM entry for each termtype that is colorizable
TERM Eterm
TERM ansi
TERM color-xterm
TERM con132x25
TERM con132x30
TERM con132x43
TERM con132x60
TERM con80x25
TERM con80x28
TERM xterm-debian
# Below are the color init strings for the basic file types. A color init
# string consists of one or more of the following numeric codes:
# Attribute codes:
# 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed
# Text color codes:
# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
# Background color codes:
# 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white
#NORMAL 00 # no color code at all
#FILE 00 # regular file: use no color at all
RESET 0 # reset to “normal“ color
DIR 01;34 # directory
LINK 01;36 # symbolic link. (If you set this to 'target' instead of a
# numerical value, the color is as for the file pointed to.)
HARDLINK 44;37 # regular file with more than one link
FIFO 40;33 # pipe
SOCK 01;35 # socket
DOOR 01;35 # door
BLK 40;33;01 # block device driver
CHR 40;33;01 # character device driver
ORPHAN 40;31;01 # symlink to nonexistent file, or non-stat'able file
SETUID 37;41 # file that is setuid (u+s)
SETGID 30;43 # file that is setgid (g+s)
CAPABILITY 30;41 # file with capability
STICKY_OTHER_WRITABLE 30;42 # dir that is sticky and other-writable (+t,o+w)
OTHER_WRITABLE 34;42 # dir that is other-writable (o+w) and not sticky
STICKY 37;44 # dir with the sticky bit set (+t) and not other-writable
# This is for files with execute permission:
EXEC 01;32
# List any file extensions like '.gz' or '.tar' that you would like ls
# to colorize below. Put the extension, a space, and the color init string.
# (and any comments you want to add after a '#')
# If you use DOS-style suffixes, you may want to uncomment the following:
#.cmd 01;32 # executables (bright green)
#.exe 01;32
#.com 01;32
#.btm 01;32
#.bat 01;32
# Or if you want to colorize scripts even if they do not have the
# executable bit actually set.
#.sh 01;32
#.csh 01;32
# archives or compressed (bright red)
.tar 01;31

.pcx 01;35
.mov 01;35
.mpg 01;35
.mpeg 01;35
.m2v 01;35
.mkv 01;35
.ogm 01;35
.mp4 01;35
.m4v 01;35
.mp4v 01;35
.vob 01;35
.qt 01;35
.nuv 01;35
.wmv 01;35
.asf 01;35
.rm 01;35
.rmvb 01;35
.flc 01;35
.avi 01;35
.fli 01;35
.flv 01;35
.gl 01;35
.dl 01;35
.xcf 01;35
.xwd 01;35
.yuv 01;35
# http://wiki.xiph.org/index.php/MIME_Types_and_File_Extensions
.axv 01;35
.anx 01;35
.ogv 01;35
.ogx 01;35
# audio formats
.aac 00;36
.au 00;36
.flac 00;36
.mid 00;36
.midi 00;36
.mka 00;36
.mp3 00;36
.mpc 00;36
.ogg 00;36
.ra 00;36
.wav 00;36
# http://wiki.xiph.org/index.php/MIME_Types_and_File_Extensions
.axa 00;36
.oga 00;36
.spx 00;36
.xspf 00;36
由JSRUN为你提供的Shell/Bash在线运行、在线编译工具
        JSRUN提供的Shell/Bash 在线运行,Shell/Bash 在线运行工具,基于linux操作系统环境提供线上编译和线上运行,具有运行快速,运行结果与常用开发、生产环境保持一致的特点。