Results 1 to 2 of 2

Thread: Shell scripting

  1. #1

    Member Since
    Jul 07, 2006
    B&W G3, 400 MHz, 10.3; 2 GHz Gateway with WinXP and Debian Linux dual-boot
    Shell scripting
    I want to put my program in a folder with some other stuff, including a .command file that will run the programming environment my program uses, tell it to open my program, and send it some flags.
    I would like to set up the .command file so that it knows the path from which the commandline is called; ie, the path to the command file itself, so that a user can put this folder anywhere they like and be able to run it.

    I also can't get the commandline to pass flags to the programming environment executable. This is the commandline I'm using, that should work:

    #! /bin/sh

    ../Shared/Documents/CSHJr/JIsequencershare/ -font 36

    Now if I just take off the -font flag, it opens Pd fine. But like this, it says:

    Last login: Fri Sep 8 13:51:57 on ttyp1
    /Users/Shared/Documents/CSHJr/JIsequencershare/JI.command; exit
    Welcome to Darwin!
    AC-T1212-M13:~ student$ /Users/Shared/Documents/CSHJr/JIsequencershare/JI.command; exit
    retrying connect...
    retrying connect...
    retrying connect...
    retrying connect...
    retrying connect...
    retrying connect...
    retrying connect...
    retrying connect...
    retrying connect...
    connecting stream socket: Invalid argument (22)
    [Process completed]

    I checked out the open, exec, and chflag commands, none of them seem to help. I would also like to replace that huge path to the executable with some sort of environment variable giving the path to where the command is called from.

    Are either of these requests possible?

  2. #2

    xstep's Avatar
    Member Since
    Jun 25, 2005
    On the road
    2011 MBP, i7, 16GB RAM, MBP 2.16Ghz Core Duo, 2GB ram, Dual 867Mhz MDD, 1.75GB ram, ATI 9800 Pro vid
    I'm not really sure what your looking for, but try the below sample. Don't forget to make it executable.

    I named the script in my root directory, cd'd to /tmp, and typed;
    ~/ -font 35


    echo $0 #this is the path as typed to run this script.
    echo $1 $2 #there are the two variables passed in

    mypwd=`pwd` #get the present working directory the user executed this from.
    echo $mypwd #echo the present working directory.


Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Bash shell scripting in OS X
    By V6Pony in forum macOS - Development and Darwin
    Replies: 18
    Last Post: 02-24-2016, 11:39 AM
  2. noob shell scripting question
    By mikeb in forum macOS - Development and Darwin
    Replies: 2
    Last Post: 03-22-2009, 12:36 PM
  3. Replacing white MacBook shell with black MacBook shell.
    By Ricerind in forum Apple Notebooks
    Replies: 8
    Last Post: 08-27-2008, 01:58 PM
  4. help with basic shell scripting
    By jrcal in forum macOS - Development and Darwin
    Replies: 0
    Last Post: 06-11-2007, 12:08 PM
  5. OS X Tiger shell vs RedHat Fedora Linux shell?
    By AlexN in forum macOS - Operating System
    Replies: 2
    Last Post: 09-17-2005, 07:08 PM

Posting Permissions

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