Re: [Flightgear-devel] Parking position names with spaces, a problem?
Hi Roland, Roland Häder wrote: Can those spaced names be fixed e.g. to names with underscores? Or won't FGFS (latest GIT/master here) find them? I think it's impracticable to force every parking position name worldwide not to have spaces, especially since it may be just a name and not an index or logical identifier (What's in a name ? ;-) Proper quoting should solve most space-related issues in shell scripts and if this still fails, like in a for-loop, try to insert some unique character and remove it with 'sed' later, when you're actually writing the config file. Cheers, Martin. -- Unix _IS_ user friendly - it's just selective about who its friends are ! -- -- Xperia(TM) PLAY It's a major breakthrough. An authentic gaming smartphone on the nation's most reliable network. And it wants your games. http://p.sf.net/sfu/verizon-sfdev ___ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel
Re: [Flightgear-devel] Parking position names with spaces, a problem?
Hi Martin, okay, I already have an idea, freely from my mind: $ sed s/\ /FGFS_LAUNCHER_SPACE/ If that is working, I think no parking lot will be named with that. :) Regards, Roland On Fri, 2011-04-08 at 18:51 +, Martin Spott wrote: Hi Roland, Roland Häder wrote: Can those spaced names be fixed e.g. to names with underscores? Or won't FGFS (latest GIT/master here) find them? I think it's impracticable to force every parking position name worldwide not to have spaces, especially since it may be just a name and not an index or logical identifier (What's in a name ? ;-) Proper quoting should solve most space-related issues in shell scripts and if this still fails, like in a for-loop, try to insert some unique character and remove it with 'sed' later, when you're actually writing the config file. Cheers, Martin. signature.asc Description: This is a digitally signed message part -- Xperia(TM) PLAY It's a major breakthrough. An authentic gaming smartphone on the nation's most reliable network. And it wants your games. http://p.sf.net/sfu/verizon-sfdev___ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel
Re: [Flightgear-devel] Parking position names with spaces, a problem?
On 2011/04/08, at 14:45 , Roland Häder wrote: Hi all, for example the airport LFPG has a parking position with a name with spaces in it. My little launcher script [1] does currently not support this because of a for() loop will break those spaces into seperate lines. Assume that ${OPTIONS} is the list of command-line parmeters (I know, I should rename that): -- Snip # Flushs all options to ~/.fgfsrc fgfs_flush_options() { echo $0: Flushing options to ~/.fgfsrc ... echo -n ${HOME}/.fgfsrc for entry in ${OPTIONS}; do echo ${entry} ${HOME}/.fgfsrc done } -- Snap Can those spaced names be fixed e.g. to names with underscores? Or won't FGFS (latest GIT/master here) find them? If not, can I somehow support them in my script? If you write OPTIONS as an array: OPTIONS=( --airport=LFPG --parking='P 12' ) then you can write: for option in ${OPTIONS[@]} ; do printf %s\n $option done ${HOME}/.fgfsrc Now, while we get one option per line, we lose the quote in .fgfsrc. If you need the quote there, then you may add them in a ad-hoc manner: OPTIONS=( --airport=LFPG --parking='P 12' ) or you may quote systematically all the options you write: for option in ${OPTIONS[@]} ; do printf '%s'\n $option done ${HOME}/.fgfsrc but this would break if there is an option containing single quote. To do the right thing, you have to know exactly how .fgfsrc is processed. -- __Pascal Bourguignon__ http://www.informatimago.com -- Xperia(TM) PLAY It's a major breakthrough. An authentic gaming smartphone on the nation's most reliable network. And it wants your games. http://p.sf.net/sfu/verizon-sfdev ___ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel
Re: [Flightgear-devel] Parking position names with spaces, a problem?
Hi, thanks for that valuable hint! I have rewritten my script to use arrays (and encapsulated adding parameters to it). Now I just need to rewrite multiple parameters to single... :( Regards, Roland On Fri, 2011-04-08 at 23:28 +0200, Pascal J. Bourguignon wrote: On 2011/04/08, at 14:45 , Roland Häder wrote: Hi all, for example the airport LFPG has a parking position with a name with spaces in it. My little launcher script [1] does currently not support this because of a for() loop will break those spaces into seperate lines. Assume that ${OPTIONS} is the list of command-line parmeters (I know, I should rename that): -- Snip # Flushs all options to ~/.fgfsrc fgfs_flush_options() { echo $0: Flushing options to ~/.fgfsrc ... echo -n ${HOME}/.fgfsrc for entry in ${OPTIONS}; do echo ${entry} ${HOME}/.fgfsrc done } -- Snap Can those spaced names be fixed e.g. to names with underscores? Or won't FGFS (latest GIT/master here) find them? If not, can I somehow support them in my script? If you write OPTIONS as an array: OPTIONS=( --airport=LFPG --parking='P 12' ) then you can write: for option in ${OPTIONS[@]} ; do printf %s\n $option done ${HOME}/.fgfsrc Now, while we get one option per line, we lose the quote in .fgfsrc. If you need the quote there, then you may add them in a ad-hoc manner: OPTIONS=( --airport=LFPG --parking='P 12' ) or you may quote systematically all the options you write: for option in ${OPTIONS[@]} ; do printf '%s'\n $option done ${HOME}/.fgfsrc but this would break if there is an option containing single quote. To do the right thing, you have to know exactly how .fgfsrc is processed. signature.asc Description: This is a digitally signed message part -- Xperia(TM) PLAY It's a major breakthrough. An authentic gaming smartphone on the nation's most reliable network. And it wants your games. http://p.sf.net/sfu/verizon-sfdev___ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel
Re: [Flightgear-devel] Parking position names with spaces, a problem?
Hi, I have also fixed multiple lines. Version 1.3.1 is out. :) Regards, Roland signature.asc Description: This is a digitally signed message part -- Xperia(TM) PLAY It's a major breakthrough. An authentic gaming smartphone on the nation's most reliable network. And it wants your games. http://p.sf.net/sfu/verizon-sfdev___ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel