lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Lilypond & Ubuntu Help


From: Jonathan Kulp
Subject: Re: Lilypond & Ubuntu Help
Date: Mon, 18 Aug 2008 14:02:10 -0500
User-agent: Thunderbird 2.0.0.16 (X11/20080724)

Hi Patrick,

Thanks so much for this detailed explanation. I use bash so everything should work fine. I have so much to learn. Thanks :)

Jon

Patrick Horgan wrote:
See the info manual for bash under 3.5.3 Shell Parameter Expansion.

You could also do:

srcfile=${1##*/} # subtract the longest prefix of $1 ending with / FILENOEXTENSION=${srcfile%.*} # subtract shortest suffix starting with . OUTDIR=${1%/*} # subtract shortest suffix starting with / ## means match the longest possible pattern on the end, and delete it from the beginning of the variable ($1 in this case). The pattern is */ and means delete anything ending with a /.
If I'd used one # it would delete the shortest match to the pattern.
so if the $1 held /usr/local/lilypond/file.ly
srcfile=${1#*/}
would yield local/lilypond/file.ly, not very good, but with ## we get the whole path off. % means the same thing, only delete the matched part off of the end. There's also a %% that means delete the longest match off the end. There's also stuff for substring matches and string lengths, and offset to a found match and more! Should work with bash, sh, and any shell compatible. Probably not zsh, they're in a different universe.


Patrick

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]