Answer the question
In order to leave comments, you need to log in
Why are there duplicate letters in the output of shell_exec('man whoami') on os x?
Hey! I accidentally noticed such a strange thing, it doesn’t interfere with life, but I want to understand the nature of the phenomenon just in case.
Macbook has php 5.6 / nginx / php-fmp. We create a file:
<?php
echo "<pre>";
echo phpversion();
echo shell_exec('man whoami');
5.6.24
WHOAMI(1) BSD General Commands Manual WHOAMI(1)
NNAAMMEE
wwhhooaammii -- display effective user id
SSYYNNOOPPSSIISS
wwhhooaammii
DDEESSCCRRIIPPTTIIOONN
The wwhhooaammii utility has been obsoleted by the id(1) utility, and is equiva-
lent to ``iidd - -uunn''. The command ``iidd --pp'' is suggested for normal
interactive use.
The wwhhooaammii utility displays your effective user ID as a name.
EEXXIITT SSTTAATTUUSS
The wwhhooaammii utility exits 0 on success, and >0 if an error occurs.
SSEEEE AALLSSOO
id(1)
BSD June 6, 1993 BSD
php -r 'echo phpversion(); echo shell_exec("man whoami");'
5.6.24
WHOAMI(1) BSD General Commands Manual WHOAMI(1)
NAME
whoami -- display effective user id
SYNOPSIS
whoami
DESCRIPTION
The whoami utility has been obsoleted by the id(1) utility, and is equiv-
alent to ``id - un''. The command ``id -p'' is suggested for normal
interactive use.
The whoami utility displays your effective user ID as a name.
EXIT STATUS
The whoami utility exits 0 on success, and >0 if an error occurs.
SEE ALSO
id(1)
BSD June 6, 1993 BSD
Answer the question
In order to leave comments, you need to log in
Initially, you have a message about the layout, when there is a problem with the caps, you change the message, but when there is a new problem with the layout after the caps, the text does not change and what was displayed
if (isCyrillic(keyName)) { //вывод сообщения о не правильной раскладке
//нужно добавить
var modalWindowCaps = document.getElementById("alertWindowText");
modalWindowCaps.innerHTML = ("Раскладка!");
...
} else if (capsLockEnabled && keyName != null) {
var modalWindowCaps = document.getElementById("alertWindowText");
modalWindowCaps.innerHTML = ("Включен CapsLock!");
...
}
If you look at the source text (/usr/share/man/man1/...), you will see that there is a BS code (\x08) between the duplicate characters. This came from printers, when a bold character could be obtained by going back one character (BackSpace) and reprinting it.
In the console, different programs handle this character differently, hence the difference in output.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question