Terminal / .sh app

Discussion in 'Mac Programming' started by Doman, Dec 7, 2009.

  1. Doman macrumors newbie

    Dec 7, 2009
    Hey, I recently got a command line program because I'm too much of a broke college student to pay for anything with a GUI and I want to automate this a bit. Here's what I've done.

    Save As -> Script.sh
    chmod +x Script.sh
    (Doesn't double click to run ~ opens in TextEdit)

    I open terminal and type sh Script.sh
    It runs.
    How do I get it to just run?

    When the script calls for sudo, I imagine I just get a prompt. Then after that I need it to enter in information once it opens the application.
    The automated equivalence of:
    Program> set status=on
    Program> set loader=active
    Program> set buffer=10
    Program> quit

    Echo doesn't work, so I'm lost. Any ideas?
  2. Doman thread starter macrumors newbie

    Dec 7, 2009
    edit: now a .command file.
    other issues remain.
  3. Sander macrumors 6502

    Apr 24, 2008
    Add #!/bin/sh as the first line of your script. That way, it becomes a "standalone executable". As to the function of your script, I don't quite grasp what you're trying to accomplish. If you're trying to automate some other existing application, maybe you need to look into AppleScript.
  4. SRossi macrumors regular

    May 27, 2009
    Glasgow, Scotland
    Echo wont work if u have "E" as a capital all script declarations are in small letters like: "echo", "if", "while" etc.

  5. Detrius macrumors 68000

    Sep 10, 2008
    Asheville, NC
    ditto on the "#!/bin/sh" in the first line. Also, don't forget to "chmod +x". Honestly, I've never done the ".command" thing. I just do "mycommand.sh" with the above two details.

Share This Page