Grep和cat导致终端挂断。终端显示过程进行中,但是什么也没发生 [英] Grep and cat cause Terminal to hangup. Terminal displays process going but nothing happens
问题描述
学习命令行作为进一步Web开发学习的基础。
每当我尝试使用GREP或CAT时,如果使用Mac,终端会挂断。一旦进入该过程,它将显示在顶部边框中,但是什么也没有发生。我在做什么错了?
如果您输入
$ cat
在命令行中,shell将等待
cat
将得到进一步的输入,因为您没有给它任何输入。将其发送到您要发送其输出的任何地方。默认情况下,这是stdout:终端。因此,您可以从以下内容开始:
/ Users / jpk /:510 $ cat
狗男孩van
dog boy van
foo bar baz
foo bar baz
^ D
/ Users / jpk /:511 $
当我键入 cat
并按回车键时,shell会等待直到有输入输入,然后再输入将其重定向到输出。这一直持续到我发送文件结束信号(^ D)
我不确定您对 grep看到的是什么
-当我只键入一个简单的 grep
并按Enter键时,我会得到使用说明: pre> / Users / jpk /:512 $ grep
用法:grep [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZ] [-A num] [-B num] [-C [num]]
[-e模式] [-f文件] [-二进制文件=值] [-颜色=时间]
[--context [= num]] [-目录=操作] [- -label] [--line-buffered]
[--null] [pattern] [file ...]
/ Users / jpk /:513
Learning command line as basis for further web development learning. Using a Mac whenever I try to use GREP or CAT, Terminal hangs up. Once I enter the process it displays in the top border, but nothing happens. What am I doing wrong?
If you just type
$ cat
at the command line, the shell will wait for further input, because you haven't given it any input to work on.
cat
will take its input and send it to wherever you're sending its output. By default, this is to stdout: the terminal. So you can start with something like this:
/Users/jpk/:510 $ cat
dog boy van
dog boy van
foo bar baz
foo bar baz
^D
/Users/jpk/:511 $
When I type cat
and hit return, the shell waits until some input comes in, and then it redirects that to the output. This goes on until I send an end-of-file signal (^D)
I'm not sure what you're seeing for grep
- when I just type a bare grep
and hit enter, I get usage notes:
/Users/jpk/:512 $ grep
usage: grep [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZ] [-A num] [-B num] [-C[num]]
[-e pattern] [-f file] [--binary-files=value] [--color=when]
[--context[=num]] [--directories=action] [--label] [--line-buffered]
[--null] [pattern] [file ...]
/Users/jpk/:513 $
这篇关于Grep和cat导致终端挂断。终端显示过程进行中,但是什么也没发生的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!