New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Development and Darwin Discussion and questions about development for Mac OS X.

Shell scripting


Post Reply New Thread Subscribe

 
Thread Tools
badmuthahubbard

 
Member Since: Jul 07, 2006
Posts: 29
badmuthahubbard is an unknown at this point
Mac Specs: B&W G3, 400 MHz, 10.3; 2 GHz Gateway with WinXP and Debian Linux dual-boot

badmuthahubbard is offline
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/Pd-0.39-2.app/Contents/MacOS/Pd -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)
logout
[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?
QUOTE Thanks
xstep

 
xstep's Avatar
 
Member Since: Jun 25, 2005
Location: On the road
Posts: 3,231
xstep is a name known to allxstep is a name known to allxstep is a name known to allxstep is a name known to allxstep is a name known to allxstep is a name known to allxstep is a name known to all
Mac Specs: 2011 MBP, i7, 16GB RAM, MBP 2.16Ghz Core Duo, 2GB ram, Dual 867Mhz MDD, 1.75GB ram, ATI 9800 Pro vid

xstep is offline
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 test.sh in my root directory, cd'd to /tmp, and typed;
~/test.sh -font 35


#!/bin/sh

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.

exit
QUOTE Thanks

Post Reply New Thread Subscribe


« cannot find lock file for serial device | Learning to write programs »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
OS X Tiger shell vs RedHat Fedora Linux shell? AlexN OS X - Operating System 2 09-17-2005 08:08 PM
unix shell command,does ibook have that? mac* Apple Notebooks 2 08-14-2004 08:36 AM
Shell Script on Desktop starrin OS X - Operating System 2 07-28-2004 12:25 PM
looking for a terminal emulator and command shell in Mac OSX CandiMarie OS X - Operating System 9 03-05-2004 04:53 PM
connecting to AOL without the AOL shell? newteech Running Windows (or anything else) on your Mac 0 12-26-2003 09:54 PM

All times are GMT -4. The time now is 10:17 PM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?