[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bash: error exporting/importing function with here document
From: |
Chris Lesner |
Subject: |
bash: error exporting/importing function with here document |
Date: |
Thu, 3 May 2007 20:00:40 -0400 |
This seems to be broken in several version of bash including: version
3.00.16(1)-release (i386-pc-linux-gnu)
Configuration Information [Automatically generated, do not change]:
Machine: i386
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i386'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i386-pc-linux-gnu'
-DCONF_VENDOR='pc' -DSHELL -DHAVE_CONFIG_H -I. -I../bash -I../bash/include
-I../bash/lib -g -O2
uname output: Linux portege 2.4.27-3-686 #1 Tue Dec 5 21:03:54 UTC 2006 i686
GNU/Linux
Machine Type: i386-pc-linux-gnu
Bash Version: 2.05b
Patch Level: 0
Release Status: release
Description:
Function with a here document fails to be exported/imported
Repeat-By:
$cat bin/itk/column/itkColumnTypeGenerateCommandExampleGet.bish
itkColumnTypeGenerateCommandExampleGet()
{
cat <<-'+' | tr "\t" " " | tr -s " "
cat - | utkSort
itkSchemaToColumnType
atkCacheToColumnType \"$npName\" | atkActiveTableLineSelect
| utkSort
atkCacheToColumnType \"$npName\" |
atkTransactionTableLineSelect | utkSort
itkDirToColumnType \"$dirName\" | atkActiveTableLineSelect |
utkSort
itkDirToColumnType \"$dirName\" | atkActiveTableLineSelect |
utkSort
+
}
$
$( . bin/itk/column/itkColumnTypeGenerateCommandExampleGet.bish ; export -f
itkColumnTypeGenerateCommandExampleGet ; echo ls | bash3 )
bash3: itkColumnTypeGenerateCommandExampleGet: line 8: syntax error near
unexpected token `|'
bash3: itkColumnTypeGenerateCommandExampleGet: line 8: ` | tr "\t" " " | tr
-s " "'
bash3: error importing function definition for
`itkColumnTypeGenerateCommandExampleGet'
aq bin columnTypes data dictionary doc _index java _remove tags
tags2 test
This is because:
$ ( . bin/itk/column/itkColumnTypeGenerateCommandExampleGet.bish ; export -f
itkColumnTypeGenerateCommandExampleGet ; set | less )
itkColumnTypeGenerateCommandExampleGet ()
{
cat <<-'+'
cat - | utkSort
itkSchemaToColumnType
atkCacheToColumnType \"$npName\" | atkActiveTableLineSelect | utkSort
atkCacheToColumnType \"$npName\" | atkTransactionTableLineSelect | utkSort
itkDirToColumnType \"$dirName\" | atkActiveTableLineSelect | utkSort
itkDirToColumnType \"$dirName\" | atkActiveTableLineSelect | utkSort
+
| tr "\t" " " | tr -s " "
}
However the shell function as defined above works fine as long as not
exported:
$ ( . bin/itk/column/itkColumnTypeGenerateCommandExampleGet.bish ; export -f
itkColumnTypeGenerateCommandExampleGet ;
itkColumnTypeGenerateCommandExampleGet )
cat - | utkSort
itkSchemaToColumnType
atkCacheToColumnType \"$npName\" | atkActiveTableLineSelect | utkSort
atkCacheToColumnType \"$npName\" | atkTransactionTableLineSelect | utkSort
itkDirToColumnType \"$dirName\" | atkActiveTableLineSelect | utkSort
itkDirToColumnType \"$dirName\" | atkActiveTableLineSelect | utkSort
$
Fix:
None that I know of.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- bash: error exporting/importing function with here document,
Chris Lesner <=