[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: OT help with midi2ly on command line mac os blind user
From: |
David Wright |
Subject: |
Re: OT help with midi2ly on command line mac os blind user |
Date: |
Tue, 15 Mar 2016 11:11:21 -0500 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Mon 14 Mar 2016 at 22:16:28 (-0500), Daniel Contreras wrote:
> Hello all,
> I am trying to wrap my head around this whole command line terminal. I am
> attempting to follow the steps that are listed on the �Mac OS� section on
> the lilypond website. I ,think, I have followed each step correctly
> through step 4, which is to make the file executable. I am confused as to
> what step 5 is talking about. It is the following:
>
> 1. Now, add this directory to your path. Modify (or create) a file
> called .profile in your home directory such that it contains
>
> export PATH=$PATH:~/bin
>
> This file should end with a blank line.
> I guess my questions are the following:
> How will these steps help me in using midi2ly?
Starting at step 5 (called 1 in your quote above), when your bash
shell starts up as a login shell, it reads your ~/.profile file for
your personal initialisation.
(But only a login shell, so that these commands are not repeated every
time a subsequent shell starts.)
Users who write scripts and/or programs that they want to invoke just
by typing their name will typically place these scripts (or links to
them) in one directory conventionallly called ~/bin and step 1 of the
instructions shows you how to make that if it isn't already there.
(You can run scripts/programs from anywhere by giving a pathname,
ie something containing a /, but they must be in your $PATH if you
just want to be able to type a bare name without a slash.)
Steps 2 and 3 show how you can write scripts that you will execute
by typing their (short) name, which will in turn execute a program
that has a very long name. "$@" will pass on to that program any
options and arguments you give.
For you to be able to invoke a program in this way, your script must
be executable, and that's step 4. (You need to do it to each script.)
You will then be able to type, eg, midi2ly -h or midi2ly --version
and bash will run that script, see that it starts with #!/bin/bash
and start a bash subshell which will execute the exec command on the
appropriate program.
So the final link in the chain is to put your ~/bin into your $PATH.
~/.profile does this with export PATH=$PATH:~/bin
When this is executed in your ~/.profile, the righthandside is
expanded by the shell into
the-whole:of-the:preexisting:value-of-$PATH-in:a-list:~/bin
where you'll see lots of directories separated by : (colons) with
yours tacked onto the end. This string then becomes the new value of
$PATH. "export" is necessary to make bash pass it to all subsequent
commands and subshells.
> Also, can anyone give me an example of what to type in the terminal to
> convert a midi file to lilypond format?
midi2ly name-of-midi-file.midi
On my system, it creates (or will overwrite without warning) a file in
the current directory called name-of-midi-file-midi.ly unless I
specify -o newfilename.
Cheers,
David.