[Rpcemu] RPCEmu and MacOSX
theo at markettos.org.uk
Thu Apr 21 08:13:49 PDT 2016
On Thu, Apr 21, 2016 at 03:37:12PM +0100, Martin wrote:
> In article <20160421123610.GD11090 at chiark.greenend.org.uk>,
> Theo Markettos <theo at markettos.org.uk> wrote:
> > How about something like:
> > #!/bin/sh
> > PARENT_DIR=$(dirname $0)
> > HOSTFS_DIR=$HOME/Library/Application\ Support/RPCEmu/hostfs
> > cp -a $PARENT_DIR/source $HOSTFS_DIR/target
> > open /Applications/RPCEmu.app
> Thanks Theo, I think I can sort of follow what that is doing.
> The last two lines are pretty obvious - I hope the middle two lines work
> as the syntax is not (yet) obvious to me.
I'm just setting a couple of variables that we can use later on. That's not
strictly necessary, but just being tidy rather than using them in-place.
$(dirname $0) calls the 'dirname' command on $0 and returns the output as a
string. $0 gives the filename of our script so 'dirname $0' is the parent
of our script, like <Obey$Dir>
> Is the # a comment line?
Yes, and no.
It's called the 'shebang', and must be the first line of the file. It tells
the OS the location of the program that will interpret the script. In this
case it's /bin/sh (the Bourne shell), but it could be /usr/bin/python or
/usr/local/bin/brandy or whatever. You can alternatively do:
to find python anywhere (it'll be in different places on different systems)
[None of this is Mac specific, it's standard Unix shell scripting]
> Is the 'obey' file just a text file, called anything, with no suffix?
Suffix doesn't matter - though it's conventional to add .sh - but you'll
need to make it executable. You can do that from the Finder, or at a
chmod +x my-script
> Yes indeed - I tried to follow your excellent instructions to the letter!
> The RPCEmu application is in Applications, and the data directory in
Not my instructions, but they are indeed very handy.
More information about the Rpcemu