The tag has no wiki summary.

learn more… | top users | synonyms

6
votes
5answers
500 views

How to write a script that accepts input from a file or from stdin?

How can one write a script that accept input from either a filename argument or from stdin? for instance, you could use less this way. one can execute less filename and equivalently cat filename | ...
0
votes
0answers
13 views

How to get stdout of another program [duplicate]

Some Linux program prog1 permanently prints to console. I'd like to read and analyse it's stdout in my C program prog2 as stdin. I can't change prog1 source. I expect something like this command: ...
0
votes
4answers
1k views

Bash/csh: test for end of file (EOF) of stdin

I would like to do: if not eof(stdin): pass stdin to program else: do nothing I have a feeling that it can be written fairly close to: if test ! --is-eof - ; then exec program The ...
0
votes
2answers
32 views

compare two directory trees

I have two music libraries, one a newer version than the other. I would like to compare them to figure which files I need to copy from new music tree to old. I have tried diff --brief -r ...
7
votes
6answers
4k views

Clear stdin before reading

I have the following bash script: # do some time consuming task here read -p "Give me some input: " input Now as you might have guessed, if a user presses some random keys during the "time ...
2
votes
3answers
2k views

Windows how to redirect file parameter to stdout? (Windows equivalent of `/dev/stdout`)

Windows console: Tool A can write binary data to a file, but has no option for telling it to use stdout. Tool B can read binary data from stdin and process the info in it. How can I get the output ...
2
votes
1answer
162 views

Using the same file as stdin and stdout results in empty file

If want to filter a file but if I use the same file as input and output the output file is empty. Is there another solution instead of using a second file? php -r "echo preg_replace('~/\* DEV ...
0
votes
0answers
116 views

How can I get RAR to create a segmented archive (volumes) when compressing from stdin?

I have this ZFS box where I'm creating incremental snapshots, then piping them into RAR (4.2) for compression and encryption, and finally backing those files up remotely. Thing is, RAR seems to ...
0
votes
1answer
229 views

Type an EOF without a line break

I have a little command that I use to copy/paste files around that involves pasting the base64-encoded tar archive into stdin, but the base64 utility keeps giving me and error message about my input ...
0
votes
2answers
380 views

Using a file input as stdin for a shell script does not work

I have the following script code: test.sh echo "BEGIN" while read CMD <&1; do [ -z "$CMD" ] && continue case "$CMD" in start) echo "get_start" ;; ...
0
votes
1answer
35 views

How is standard input displayed on a terminal?

According to the Wikipedia article on standard streams, The keyboard is connected to a program via standard input. I'm assuming the program refers to a shell, which interprets the commands inputted by ...
1
vote
0answers
57 views

how to simulate a file under linux?

I'm basically trying to do this using openssh: I have a private key, however it isn't in file (it's in memory). Now, I want to create the public key in openssh format. For that I would generally run ...
1
vote
1answer
172 views

Why the here-strings in bash are slower than piping the input to a command?

I compared the execution time for unix here-strings and pipe data input to bc: pipe time for i in {1..1000} do echo "sqrt(5.09)" | bc -q > /dev/null done real 0m3.584s user ...
2
votes
1answer
888 views

“stdin: is not a tty” message from scp

I got this message when I copy file using scp to CentOS server "stdin: is not a tty". What it means and how I make it go away? The transfer is ok.
3
votes
2answers
1k views

Supply SU password in a bash script, within the script?

The purpose is to restart the machine if it doesn't get an abort command from the user. The problem is that the way the terminals are set up, user must supply SU password for shutdown, init, reboot, ...
1
vote
1answer
325 views

Read from stdin to new, named, file in vim

I'd like to start vim on a non existing file, named f, with the content c. Both f and c are arbitrary and I'd like to not have to put anything in the vim config to fill new buffers with c. Basically, ...
0
votes
1answer
319 views

Is it possible in ffmpeg to seek to position of the file that is received through stdin

Is it possible to -ss in ffmpeg to the file, that is being received via pipe? So that I start reading it from a given timecode? I am not encoding the file. Thanks
0
votes
1answer
431 views

When I run a program over ssh, why does stdin stop echoing back?

When I run a particular program on my server using putty and I hit ctrl+c to stop it, my stdin stops echoing back to me at the command line. So for example, after running the program and stopping it, ...
0
votes
1answer
27 views

Piping results back into the program that generates them

I've got a program that can take input from stdin and produces output in the stdout like this: cat initial_input.txt | myprogram myindex myoptions - | filter_output > outfile.txt The program ...
0
votes
1answer
44 views

Launching a program and retrieving its standard streams later

I want to be able to start some specific servers (related to a game) on a my VPS (to which I connect through ssh). This is simple, I just connect and execute the command, but this creates some ...
2
votes
1answer
551 views

Getting back to “stdin” after redirecting a file to a particular program

I need to achieve a particular effect using bash's redirection facilities. I know that I can redirect a file to some program's standard input: [user@host]$ application < file.txt The thing is, ...
8
votes
2answers
5k views

Indicating end of Standard Input

How does one indicate that one has finished entering test in stdin? For example, let's say that I wish to encrypt 'blue' using MD5 (I know MD5 is unsecure, but just for this example). I tried user$ ...