Tag Info

New answers tagged

0

Try to put your ssh public key in another host just by one command ssh root@example.com 'cat >> .ssh/authorized_keys' < .ssh/id_rsa.pub


3

You don't need xargs at all, just use exec option: find . -maxdepth 1 -name "*.md" -exec aspell check {} \; And just in case you, or any future reader, will really need to use xargs - you can do that by spawning new shell and taking standard input from terminal (/dev/tty): find . -maxdepth 1 -name "*.sh" | xargs -n1 sh -c 'aspell check "$@" < ...


1

You could always just use a simple loop: for f in *.md; do aspell check "$f"; done


0

If all you want is to replace "Hello" with "Goodbye" (or any other word replacement) you can avoid the manual editing in an editor in favor of automatic search&replace tool. For example "sed" can do such replacements like this: echo Hello World | sed 's/Hello/Goodbye/' | less Check "man sed" for more details.


1

The text editor joe (aka Joe's Own Editor) does what you want. The command echo "hello world" | joe - | less functions as expected, although it needs the quotes for some reason. Some commands (such as gpg) produce displayed output that does not enter the pipe. This corrupts the initial display inside of joe, but hitting ctrl+r -- refresh -- will clean ...


11

The basic behavior you're seeing is that input sits in a buffer somewhere until it's read (well, if you type enough, eventually the buffers will fill up, and something will be lost, that'd be a lot of typing though). Most things run by make do not read from STDIN, so it stays in the buffer. The danger is that the wrong command reads your input. E.g., make ...


17

It works the way it does because Unix is full-duplex. As Ritchie said in The UNIX Time-sharing System: A Retrospective: One thing that seems trivial, yet makes a surprising difference once one is used to it, is full-duplex terminal I/O together with read-ahead. Even though programs generally communicate with the user in terms of lines, rather than ...


8

Well, semi-obviously, you shouldn't run a second command that depends on the first command (make, in your example) having completed successfully.  For example, make foo Enter> ./foo Enter could cause a problem.  You might want to try to get into the habit of typing things like make && make check, where the second command will be executed only if ...


4

My guess is that less calls isatty(3) on file descriptor 0. Another alternative would be to call fstat(2) on file descriptor 0 and interpret the values of the st_ino and st_rdev fields. Either way, the point is a program can tell something about a file descriptor, and stdin is just file descriptor 0. As far as why less exits and cat does not, you need to ...


6

less runs the following code when it's not given any filename arguments: if (isatty(fd0)) { error("Missing filename (\"less --help\" for help)", NULL_PARG); quit(QUIT_OK); } return (edit("-")); It's complaining when standard input is a terminal. If standard input is an ordinary file or pipe, it's OK with that. It presumably does this because it ...



Top 50 recent answers are included