sebastiencs / icons-in-terminal

Use any fonts in the terminal without replacing or patching
MIT License
1.01k stars 46 forks source link

bash 3 produces "readarray: command not found" #2

Closed cmarqu closed 7 years ago

cmarqu commented 7 years ago

Hi,

I only have access to an ancient bash version by default, and so I get ./scripts/generate_fontconfig.sh: line 6: readarray: command not found while running install.sh (readarray is a bash 4 thing from what I read).

$ bash --version
GNU bash, version 3.2.57(1)-release (x86_64-suse-linux-gnu)
Copyright (C) 2007 Free Software Foundation, Inc.
sebastiencs commented 7 years ago

Thanks for you feedback, can you confirm it works now ?

cmarqu commented 7 years ago

Thanks for the quick fix, it will take me until Monday before I can test it though (public holiday in Germany).

cmarqu commented 7 years ago

Thanks, the fonts are found now. (I do not see the glyphs however, I just get the Unicode code points printed, like \uedfb. I guess my terminal is too old too.)

A few small things: print_icons.sh is using #!/usr/bin/bash which does not exist on my system. install.sh uses #!/bin/bash in comparison - I guess this was not intentional?

I had also tried ./install-autodetect.sh without high hopes, maybe you want to work around the declare message in the output below. It's questionable however whether a system with such old tools is worth supporting in the install step when the end result cannot work in the first place... I'll leave that decision up to you.

$ ./install-autodetect.sh 
+ mkdir -p /home/colin/.fonts
+ cp ./build/icons-in-terminal.ttf /home/colin/.fonts/
+ mkdir -p /home/colin/.config/fontconfig/conf.d
+ ./scripts/generate_fontconfig_autodetect.sh
./scripts/generate_fontconfig_autodetect.sh: line 12: declare: -A: invalid option
declare: usage: declare [-afFirtx] [-p] [name[=value] ...]
/home/colin/tools/icons-in-terminal/scripts/detect_font_terminal/find_font_gnometerminal.sh: line 10: dconf: command not found
./scripts/generate_fontconfig_autodetect.sh: line 28: No font found: syntax error in expression (error token is "font found")
+ fc-cache -fvr --really-force /home/colin/.fonts
/home/colin/.fonts: caching, new cache contents: 19 fonts, 0 dirs
/var/cache/fontconfig: not cleaning unwritable cache directory
/home/colin/.fontconfig: cleaning cache directory
fc-cache: succeeded
+ DATA=/home/colin/.local/share
+ '[' -n '' ']'
+ DATA=/home/colin/.local/share/icons-in-terminal/
+ mkdir -p /home/colin/.local/share/icons-in-terminal/
+ cp ./build/icons-in-terminal.el ./build/icons-in-terminal.h ./build/icons-in-terminal.ttf ./build/icons.fish ./build/icons_bash.sh ./build/mapping.txt /home/colin/.local/share/icons-in-terminal/
+ set +xe
./scripts/generate_fontconfig_autodetect.sh: line 12: declare: -A: invalid option
declare: usage: declare [-afFirtx] [-p] [name[=value] ...]

Detected terminals fonts:

- GNOME TERMINAL:
/home/colin/tools/icons-in-terminal/scripts/detect_font_terminal/find_font_gnometerminal.sh: line 10: dconf: command not found
No font found
- TERMINATOR:
No font found

IMPORTANT:
install-autodetect.sh is experimental
If your terminal isn't listed or if there is not your font, use install.sh instead
See https://github.com/sebastiencs/icons-in-terminal/issues/1

Font successfully installed. Now start a new terminal and run print_icons.sh :)
sebastiencs commented 7 years ago

What terminal and shell are you using ? And which versions ? If you see the codepoints, it's because your shell doesn't interpret them (it is supposed to). The terminal should only support font fallback to make it work.

You can try https://github.com/sebastiencs/coreutils-icons to be sure that your terminal support it or not.

Thanks for the log I will look into it

cmarqu commented 7 years ago

GNOME Terminal 2.28.2 and GNU bash, version 3.2.57(1)-release running inside tmux 2.2. Running bash plainly in Gnome Terminal doesn't change things either.

cmarqu commented 7 years ago

FWIW, the first PS1 example in https://unix.stackexchange.com/a/25907 works, the second doesn't. So I guess I'd need at least bash 4.2.

sebastiencs commented 7 years ago

It seems that bash < 4.2 doesn't interpret utf 16, but it does with utf 8. I'm using utf 16 encoding in all the scripts

I ran bash 3.2.57 and I could print an icon with utf 8 encoding: bash

Can you try the same command ? echo -e '\xee\x83\xb1 '

cmarqu commented 7 years ago

Your example works when I use Konsole Version 2.3.3 Using KDE 4.3.5 (KDE 4.3.5) "release 0" but in GNOME Terminal, I get the square with "E0F1" in it. Actually, now that I try it in Konsole, print_icons.sh produces the nice icons! So it was a GNOME Terminal issue all the time?

sebastiencs commented 7 years ago

Glad to hear that. Yes this version of gnome terminal probably doesn't support font fallback