3

If for example I run a command from the terminal like this:

$ find . | xargs grep something

The terminal then goes in a sort of pending state and I can type in characters and whatnot as I wait for the command to start printing stuff to stdout.

What happens with that input? Is it saved somewhere, does it do anything at all? I know I can use it to pass signals to the application (such as SIGINT by way of typing in ^C) but what about some other input? I'm referring specifically to the cases where the application is not prompting the user for input.

Thanks and apologies if this is a bit obvious.

2
  • 1
    Just a word of caution: find and xargs are better used with find … -print0 | xargs -0 to overcome issues with spaces or newlines in file names. You'll find that your command won't work for a file called, let's say "foo bar".
    – slhck
    Jan 14, 2013 at 15:42
  • Thanks for that, normally on our environment very seldom would a file have a space in it but it's a good habit to start calling it like you've suggested.
    – Nobilis
    Jan 14, 2013 at 15:46

1 Answer 1

6

Other input is saved in a buffer and is used for the next command in the shell.

3
  • Sorry, does this mean that while the process executes any rubbish I've typed in (e.g. asdasdekhef) will be passed on to the next command?
    – Nobilis
    Jan 14, 2013 at 15:45
  • 1
    As John says, the text you paste/write is taken to be a command and is executed once the running process ends. This is very handy when pasting a long list of commands into a terminal since they will be run sequentially.
    – terdon
    Jan 14, 2013 at 15:47
  • 1
    I weep for the future. Jun 14, 2017 at 5:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .