Prev: read multiple fields separated by : and fields separated by , in loop stored in $var
Next: Question: add a CC list to `mail` command
From: David Combs on 12 Apr 2010 00:22 In article <74642586.VlcvoiGErg(a)PointedEars.de>, Thomas 'PointedEars' Lahn <usenet(a)PointedEars.de> wrote: >Dr. David Kirkby wrote: .... >> >> Is that POSIX compliant? > >The syntax: yes. The statement above: no, and that is not what happens. >$gapver will be set in any case. See SUSv3, 2.6.2 Parameter Expansion: Please, what is SUSv3? Thanks, David
From: Chris F.A. Johnson on 12 Apr 2010 01:03 On 2010-03-15, Thomas 'PointedEars' Lahn wrote: > Dr. David Kirkby wrote: > >> ${gapver:=$SAGE_ROOT/spkg/standard/newest_version gap} >> GAP0=`$gapver` >> >> SAGE_ROOT will be an absolute path, so $SAGE_ROOT/spkg/standard/ >> newest_version is a program which takes an argument which in this case >> is "gap". >> >> Someone has said: >> >> "The meaning of ':=' there is to only set $gapver to $SAGE_ROOT/ >> spkg/.... if >> $gapver was unset or null previously. >> " >> >> Is that POSIX compliant? > > The syntax: yes. The statement above: no, and that is not what happens. > $gapver will be set in any case. No, it will only be set (to $SAGE_ROOT/...) if it was unset or null, as described by: > See SUSv3, 2.6.2 Parameter Expansion: > >| parameter parameter parameter >| Set and Not Null Set But Null Unset >| [...] >| ${parameter:=word} Substitute parameter assign word assign word Which is exactly what Dr. Kirby stated. -- Chris F.A. Johnson, author <http://shell.cfajohnson.com/> =================================================================== Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress) Pro Bash Programming: Scripting the GNU/Linux Shell (2009, Apress) ===== My code in this post, if any, assumes the POSIX locale ===== ===== and is released under the GNU General Public Licence =====
From: Bill Marcum on 12 Apr 2010 03:30 On 2010-04-12, David Combs <dkcombs(a)panix.com> wrote: > In article <74642586.VlcvoiGErg(a)PointedEars.de>, > Thomas 'PointedEars' Lahn <usenet(a)PointedEars.de> wrote: >>Dr. David Kirkby wrote: > ... >>> >>> Is that POSIX compliant? >> >>The syntax: yes. The statement above: no, and that is not what happens. >>$gapver will be set in any case. See SUSv3, 2.6.2 Parameter Expansion: > > Please, what is SUSv3? > Single Unix Specification, version 3. The SUSv3 standard is practically the same as POSIX, but SUSv3 documents are freely available on the web. -- Newton's Law of Gravitation: What goes up must come down. But don't expect it to come down where you can find it. Murphy's Law applies to Newton's.
From: Thomas 'PointedEars' Lahn on 12 Apr 2010 08:24 Chris F.A. Johnson wrote: > Thomas 'PointedEars' Lahn wrote: >> Dr. David Kirkby wrote: >>> ${gapver:=$SAGE_ROOT/spkg/standard/newest_version gap} >>> GAP0=`$gapver` >>> >>> SAGE_ROOT will be an absolute path, so $SAGE_ROOT/spkg/standard/ >>> newest_version is a program which takes an argument which in this case >>> is "gap". >>> >>> Someone has said: >>> >>> "The meaning of ':=' there is to only set $gapver to $SAGE_ROOT/ >>> spkg/.... if >>> $gapver was unset or null previously. >>> " >>> >>> Is that POSIX compliant? >> >> The syntax: yes. The statement above: no, and that is not what happens. >> $gapver will be set in any case. > > No, it will only be set (to $SAGE_ROOT/...) if it was unset or > null, At least that is what happens in bash 4.1.2(1). Thanks. > as described by: > >> See SUSv3, 2.6.2 Parameter Expansion: >> >>| parameter parameter parameter >>| Set and Not Null Set But Null Unset >>| [...] >>| ${parameter:=word} Substitute parameter assign word assign word >>| > > Which is exactly what Dr. Kirby stated. Yes, apparently I misunderstood "substitute parameter" as "substitute the value of parameter (with word)". PointedEars
From: Chris F.A. Johnson on 12 Apr 2010 13:40
On 2010-04-12, Thomas 'PointedEars' Lahn wrote: > Chris F.A. Johnson wrote: > >> Thomas 'PointedEars' Lahn wrote: >>> Dr. David Kirkby wrote: >>>> ${gapver:=$SAGE_ROOT/spkg/standard/newest_version gap} >>>> GAP0=`$gapver` >>>> >>>> SAGE_ROOT will be an absolute path, so $SAGE_ROOT/spkg/standard/ >>>> newest_version is a program which takes an argument which in this case >>>> is "gap". >>>> >>>> Someone has said: >>>> >>>> "The meaning of ':=' there is to only set $gapver to $SAGE_ROOT/ >>>> spkg/.... if >>>> $gapver was unset or null previously. >>>> " >>>> >>>> Is that POSIX compliant? >>> >>> The syntax: yes. The statement above: no, and that is not what happens. >>> $gapver will be set in any case. >> >> No, it will only be set (to $SAGE_ROOT/...) if it was unset or >> null, > > At least that is what happens in bash 4.1.2(1). Thanks. That's what happens with *any* Bourne-type shell. >> as described by: >> >>> See SUSv3, 2.6.2 Parameter Expansion: >>> >>>| parameter parameter parameter >>>| Set and Not Null Set But Null Unset >>>| [...] >>>| ${parameter:=word} Substitute parameter assign word assign word >>>| >> >> Which is exactly what Dr. Kirby stated. > > Yes, apparently I misunderstood "substitute parameter" as "substitute the > value of parameter (with word)". > > > PointedEars -- Chris F.A. Johnson, author <http://shell.cfajohnson.com/> =================================================================== Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress) Pro Bash Programming: Scripting the GNU/Linux Shell (2009, Apress) ===== My code in this post, if any, assumes the POSIX locale ===== ===== and is released under the GNU General Public Licence ===== |