Bash command query

Hi guys and thanks.
Not the most urgent request, but I don’t really know how to search for it in google.
I want to know what command lets me open a program then input something into that program.
Specifically I wanted to open Dosbox and then automatically input a mount command. I have since found that Dosbox conf file lets you input some automatic commands, so in the short term the problem is solved.
But if I wanted to create different scripts that had different mounting options, how would I do that?

In my mind it would look something like:


commandX "mount c /home/user/games"

Any ideas? Like I said I tried googling, but I don’t have the language to describe what I’m doing, so couldn’t find anything useful.
Many thanks

if I understand your question correctly then it is about input redirection.
for example:

# cat <<EOF
  > hello
  > world
  > EOF 

if so, then just do the same in a bash script.

To elaborate on the answer above, your commandX is of course the command you start your Dosbox with (you do not tell, but for this post I will use dosbox). Thus the script becomes:

dosbox <<EOF
mount c /home/user/games

Put that file somewhere (e.g. in the bin directory within your home directory is a good place because it is in your PATH) giving it a nice name like dosgames.
Do not forget to make it executable with

chmod +x dosgames

and execute it by simply typing