0

I googled, but it ignore the "%". all about pid.

My system is macOS.

Here's the code:

cat /usr/local/var/run/php-fpm.pid
#I got this.
7260%

#When I use vim open it. only have text "7260" 7260

Could you tell me why ? Thank you very much.

2 Answers2

2

Your file doesn't finish with a newline, so Zsh appends a reverse-video % and a newline itself (both to indicate that the file doesn't end with a newline, and to avoid messing up the following prompt or losing the output entirely).

Question 3.23 of the Zsh FAQ has more detail on how to control this, as does the Zsh manual.

Stephen Kitt
  • 434,908
0

In Unix, the line ending is LF (\n), when a line is missing that, the next line is tacked to the current line at end as if they were a single line.

This is what happening here, the file /usr/local/var/run/php-fpm.pid got a single line with the PID and the line does not end in LF, on most shells yopu would get the next prompt tacked with the output, but here zsh is being smart and adding a % and \n indicating the line is missing a LF.

Example:

foo@bar% cat /proc/self/cmdline
cat/proc/self/cmdline%                                                             
foo@bar% bash
foo@bar$ cat /proc/self/cmdline 
cat/proc/self/cmdlinefoo@bar$
heemayl
  • 56,300