Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Is there any method to interact with a program directly from the commmand line?

For example, I've a program, data.o, which produces a file mydata.out and then I want to plot it with gnuplot.

I can open the plotting program with gnuplot & and then I would like the shell to write somehow in this job/background shell I just opened plot mydata.out. (gnuplot is just an example, the question would be similar for executing some Macros or Hotkeys in every program I can open from the command line without leaving it).

share|improve this question
    
you should google about inter-process communication. and also u should go down in programming in linux to understand that ur question is crude. –  neckTwi Jun 26 '13 at 9:27
add comment

2 Answers

up vote 2 down vote accepted
  • some programs like gnuplot accept a command file, it may be easier to generate on and then pass it as argument.

  • some programs don't depend on interaction, for them piping to stdin may work

    (
        printf "my command\n"
        printf "my other command line\n"
    ) | theProgram and its args
    
  • other depend on interaction and mandate that their standard input is a terminal, you have to use expect or equivalent.

share|improve this answer
add comment

programs or services that implement d-bus can be interacted from command line or from any other process. https://developer.gnome.org/gio/2.29/gdbus.html and googling about it should give you insight about inter-process communication.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.