macos – Mac终端奇怪行为(按Enter键时没有换行符,没有可见文本)

我在Mac OS X 10.11.3上我的终端看起来像这样:

[Fabian@MacBook-Pro] > 
[Fabian@MacBook-Pro] > pyspark
Python 2.7.11 (default, Jan 29 2016, 17:48:19) 
[GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
16/03/17 10:08:22 WARN NativeCodeLoader: Unable to load native-hadoop library     for your platform... using builtin-java classes where applicable
Welcome to

      ____              __
     / __/__  ___ _____/ /__
    _\ \/ _ \/ _ `/ __/  '_/
   /__ / .__/\_,_/_/ /_/\_\   version 1.6.1
      /_/

Using Python version 2.7.11 (default, Jan 29 2016 17:48:19)
SparkContext available as sc, HiveContext available as sqlContext.
>>> print 'hello'
>>> hello

>>> quit()
>>> [Fabian@MacBook-Pro] > [Fabian@MacBook-Pro] > [Fabian@MacBook-Pro] > [Fabian@MacBook-Pro] > -bash:     printsf: command not found

在第一行我输入,如你所见,提示从另一行开始,然后我启动pyspark,做一些事情并退出,然后当我返回提示时按Enter键,如你所见,提示没有t出现在换行符中!我实际打字并且屏幕上没有打印任何内容,但是您可以看到命令执行

-bash:     printsf: command not found

我的.bash_profile(位于/ Users / Fabian文件夹中)看起来像这样

# Setting PATH for Python 3.4
# The orginal version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.4/bin:${PATH}"
export PATH
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export PYTHONPATH=$PYTHONPATH:/Users/Fabian/Library/Python

##
# Your previous /Users/Fabian/.bash_profile file was backed up as /Users/Fabian/.bash_profile.macports-saved_2016-02-07_at_11:26:24
##

# MacPorts Installer addition on 2016-02-07_at_11:26:24: adding an appropriate PATH variable for use with MacPorts.
export PATH="/opt/local/bin:/opt/local/sbin:$PATH"
# Finished adapting your PATH environment variable for use with MacPorts.

export JAVA_HOME=$(/usr/libexec/java_home)
export PATH=$PATH:/Users/Fabian/apache-maven-3.3.9/bin
export PS1="[\u@\h] > "
export PATH=$PATH:/Users/Fabian/spark-1.6.1-bin-hadoop2.6/bin

我该如何解决这个问题?
谢谢!

正如评论中所述(以及OP所描述的),每条消息丢失后的预期换行符.那是因为应用程序改变了处理回车/换行的终端I / O模式,例如,

>按回车(这是一个回车)没有被翻译成换行符(实际上是一个换行符),和
>从计算机发送的换行符未转换为回车/换行.

但是,在“任何”键盘上,您可以按controlJ键入换行符.通常的修复应用首先按下controlJ来获得提示,并按下controlJ完成命令:

> stty sane(重置终端驱动程序)
> reset(重置终端驱动程序以及要求终端自行重置).

本站公众号
   欢迎关注本站公众号,获取更多程序园信息
开发小院