4
$ type -a short_command
short_command is aliased to `some_long_and_obnoxious_command_that_I_never_want_to_type'

Why does Bash (and perhaps every other shell) frequently—as above—use a backtick character in place of an opening quotation mark? And is there any way to change this?

Zsh doesn't do it in that context and I'm not sure if Zsh itself does this anywhere or not, but if Zsh ever does it then I'd also be interested in controlling it there.

iconoclast
  • 9,057
  • 12
  • 56
  • 95
  • Possibly related: [Why do Unix man pages use double backticks in place of double quotes?](https://unix.stackexchange.com/questions/73989/why-do-unix-man-pages-use-double-backticks-in-place-of-double-quotes) – steeldriver May 04 '20 at 20:46
  • 1
    Great, now I can't unsee it. – ilkkachu May 05 '20 at 23:09

1 Answers1

3

And is there any way to change this?

Starting bash with LANGUAGE=en@quot in its environment works for me:

bash-5.0$ LANGUAGE=en@quot:en_US:en bash
bash-5.0$ alias foo=bar
bash-5.0$ type foo
foo is aliased to ‘bar’

Notice the ‘bar’ (with U+2018 and U+2019) instead of `bar'

Also look into LANGUAGE=en@boldquot. Setting LANGUAGE from inside bash does not work, though. Neither does setting LC_MESSAGES to en@quot.

Have a good time studying the gettext(3) and msgfmt(1) manpages if you want more information.

  • This worked on macOS, but failed on Bash version 4.3.48(1)-release (x86_64-pc-linux-gnu) on Ubuntu. Any ideas why that might be? Does it require Bash 5? – iconoclast May 05 '20 at 17:53
  • @iconoclast you probably don't have `en_US` in your locale. What does `env | grep LANG` report? Then use that instead. – roaima May 05 '20 at 18:17
  • @roaima Inside the shell started as above it shows `LANG=en_US.UTF-8` and `LANGUAGE=en@quot:en_US:en`. Outside that shell it only shows the first one. – iconoclast May 05 '20 at 18:42
  • Strange. Works for me (`LANGUAGE=en@quot:en_GB:en`) not only with `bash` version 5.0.3(1)-release but also with version 4.3.30(1)-release. – roaima May 05 '20 at 22:21