Ah. It never occurred to me to try to allow for anything but the standard "lilypond filename.ly" command. That's a good idea. I don't use anything but the standard command very often, though, so I won't lose any sleep over it. I *was* prepared to lose sleep over the fact that the output files weren't ending up in the right directory ;-) Glad to have figured that one out.

I didn't even know the basename command until today when I started researching the problem. I have a book to thank for that. The book and the manpage for basename both mention the extension-chopping function. Very useful. I was using a sed command to do that before, but I like basename better b/c I didn't really understand what sed was doing, I just copied and slightly tweaked someone else's line of code in another script (sort of like what we do with lilypond snippets, I guess). The advantage of sed over basename for this, though, is that sed doesn't require you to specify exactly what the extension is that you want to chop off. I tried using "basename ~/Documents/filename.ly .*" and it returned errors. You have to tell it exactly what extension you want to extract: "basename ~/Documents/filename.ly .ly" returns "filename". This is fine for a script designed specifically for lilypond, but it would be more flexible if it allowed for a wildcard that would chop off whatever extension happened to be there.

The book is "Beginning Shell Scripting," by Eric Foster-Johnson, John Welch, and Micah Anderson. I also have "Classic Shell Scripting," an O'Reilly book, but I find that Beginning Shell Scripting is better about explaining every detail of every example, which is important for me since I'm such a newb :).

Thanks for writing the script, Jay. I'm going to study and break it down bit by bit to see what I can learn from it. It works great!

Jon

Jay Anderson wrote:

The scripts do essentially the same thing. The only thing I was trying
to do was allow for normal lilypond command line arguments also. The
sed line is a hack to pull out all but the last argument. It will
break if the last argument is quoted and has a space in it.

-----Jay

P.S. I didn't know basename took a second argument to chop off the
extension. Neat.


--
Jonathan Kulp
http://www.jonathankulp.com


_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to