Results 1 to 3 of 3

Thread: Bash command query

  1. #1

    Question 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:
    Code:
    dosbox
    
    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
    Ben

  2. #2
    Join Date
    Dec 2009
    Location
    Moldova
    Posts
    129

    Default Re: Bash command query

    if I understand your question correctly then it is about input redirection.
    for example:
    Code:
    # cat <<EOF
      > hello
      > world
      > EOF
    if so, then just do the same in a bash script.

  3. #3
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,142

    Default Re: Bash command query

    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:
    Code:
    #!/bin/bash
    dosbox <<EOF
    mount c /home/user/games
    EOF
    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
    Code:
    chmod +x dosgames
    and execute it by simply typing
    Code:
    dosgames
    Henk van Velden

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •