Linux의 LS_COLORS를 BSD의 LSCOLORS로 변환하는 방법은 무엇입니까?

Linux의 LS_COLORS를 BSD의 LSCOLORS로 변환하는 방법은 무엇입니까?

나는 LSCOLORS(BSD)를 사용해 보았습니다.발전기다음 LS_COLORS(Linux)을 BSD에서 허용하는 형식으로 변환합니다.

BSD 에 대해 읽은 후 man ls특정 파일 확장자(예:)를 지원하지 않는 것 같아서 *.tgz=01;31다음 구성 요소만 고려했습니다 LS_COLORS.

di=34:ln=35:so=32:pi=33;40:ex=31:bd=34;46:cd=34;43:su=30;41:sg=30;46:tw=30;42:ow=30;43

이는 다음과 같은 LSCOLORS형식을 갖습니다: exfxcxdabxegedabagacad.

이제 아래의 특정 콘텐츠에 대한 내 문제 는 이를 다음과 같은 형식 으로 표현하는 LS_COLORS방법을 모른다는 것입니다 . 특히, 생성기에서는 첫 번째 세미콜론( ) 앞의 값을 선택하는 것을 허용하지 않습니다.pi=40;33LSCOLORS4040;33

LS_COLORS(데비안 9):

parallels@debian-gnu-linux-vm:~$ dircolors
LS_COLORS='rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=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:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=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:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:';
export LS_COLORS

답변1

인용하다맨페이지:

           a     black
           b     red
           c     green
           d     brown
           e     blue
           f     magenta
           g     cyan
           h     light grey
           A     bold black, usually shows up as dark grey
           B     bold red
           C     bold green
           D     bold brown, usually shows up as yellow
           E     bold blue
           F     bold magenta
           G     bold cyan
           H     bold light grey; looks like bright white
           x     default foreground or background

요구되는 pi=40;33것은검은색배경과갈색전망. 이는 LSCOLORS쌍으로 표시됩니다.ad:

           a     black
           d     brown

에는 세미콜론이 없습니다 LSCOLORS. 의 세미콜론은 LS_COLORS색상을 설정하는 데 사용되는 이스케이프 시퀀스에서 매개변수 구분 기호로 사용됩니다(일부 하드 코딩된 가정 포함). SGR에서 두 자리 색상 값 사용(그래픽 렌더링 선택)제어 순서.

그 사람의 행동에 대해발전기은 다음 블록을 포함하는 JavaScript 파일입니다.

// Linux LS_COLORS has different codes for foreground/background colors :/
if (i % 2 === 0) {
  // If bold, add bold thingy
  if (color === color.toUpperCase()) {
    linuxColorString += "1;";
    color = color.toLowerCase();
  }

이는 분명히 Linux 콘솔용으로 설계되었습니다(AH를 다음으로 매핑).용감한아 ), 그러나 xterm과 같은 다른 터미널과 함께 사용할 수 있습니다.대담한 색상자원

   boldColors (class ColorMode)
           Specifies whether to combine bold attribute with colors like
           the IBM PC, i.e., map colors 0 through 7 to colors 8 through
           15.  These normally are the brighter versions of the first 8
           colors, hence bold.  The default is "true".

그러나 ( 에서는 무시되었습니다 console_codes(4).현재의그리고나이가 많은), Linux 콘솔에서는 전경(SGR에서 굵은 글씨 사용, "1" 사용) 및 배경(깜박임 사용, "5" 사용)에 대해 16가지 색상을 설정하는 방법을 제공합니다. 이것linux-16color터미널 설명은 이 기능을 사용합니다. GNU ls는 터미널 설명을 사용하지 않습니다. Generator도 마찬가지입니다. 그러나 생성기는 굵은 글씨가 ANSI 색상(0-7)(코드 8-15)에서 더 밝은 버전을 생성한다고 가정합니다.

관련 정보