I'm a little suspicious of how to use the term prompt.
Cause unknown.
When there is output in the terminal, the new prompt starts continuously from the end of the output.
# echo -n abc
abc#
(#Prompts)
However, in the case of fish, if the output is 2 or more characters, it will be as above, but if it is 1 character, the cursor may not be moving or it will be overwritten.
# echo -n a
#
(↑ There is no output of a)
It may get caught when outputting the result with one character at the end, 01 or tf in the test code etc.
CentOS7
# bash -version
GNU bash, version 4.2.46(1)-release (x86_64-redhat-linux-gnu)
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
# fish -v
fish, version 2.5.0
# python -V
Python 2.7.5
# php -v
PHP 5.4.16 (cli) (built: Nov 6 2016 00:29:02)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
with the ionCube PHP Loader (enabled) + Intrusion Protection from ioncube24.com (unconfigured) v6.0.9, Copyright (c) 2002-2016, by ionCube Ltd.
with uopz v2.0.7, Copyright (c) 2014, by Joe Watkins <[email protected]>
with Zend OPcache v7.0.5, Copyright (c) 1999-2015, by Zend Technologies
with strict v0.4.1, Copyright (c) 2014, by Joe Watkins <[email protected]>
with Suhosin v0.9.38, Copyright (c) 2007-2015, by SektionEins GmbH
The execution result is the same as the one described in the overview, so it is omitted.
Shell script
vanish.sh
# -Output with the n option to remove the trailing newline
echo -n a
PHP
vanish.php
<?php
echo 'a';
Python
vanish.py
import sys
#python print is the default line break.
sys.stdout.write('a')
I felt uncomfortable when I moved it several times, so
<?php
echo 'a';
sleep(1);
After a while from the output to the end of the script, it was confirmed that a was output properly. When the script finishes, it seems to be overwritten at the prompt.
Recommended Posts