On Thu, 29 Oct 2009, Greg Wooledge wrote:
> On Thu, Oct 29, 2009 at 11:49:11AM -0400, Gerard wrote:
> > Are you sure? Using: IFS=$(echo) seems to set IFS to a newline here.
>
> imadev:~$ IFS=$(echo)
> imadev:~$ printf "%s" "$IFS" | od -t x1
> 000
> imadev:~$ printf "\n" | od -t x1
> 000
On Thu, Oct 29, 2009 at 11:49:11AM -0400, Gerard wrote:
> Are you sure? Using: IFS=$(echo) seems to set IFS to a newline here.
imadev:~$ IFS=$(echo)
imadev:~$ printf "%s" "$IFS" | od -t x1
000
imadev:~$ printf "\n" | od -t x1
000a
001
imadev:~$ echo ${#IFS}
0
imadev:~$ unset IFS
A
On Wed, 28 Oct 2009 08:38:07 -0400
Greg Wooledge replied:
> > I have tried setting:
> > IFS=$( echo )
>
> $() removes all trailing newlines from the output of the command that
> it executes. You're setting IFS to an empty string. If you want to
> set IFS to a newline, use this:
>
> IFS=
On Wed, Oct 28, 2009 at 06:04:00AM -0400, Gerard wrote:
> COM_LINE="-u${SQL_USER} -p${SQL_PASSWORD} -h ${HOST} ${NO_COLUMN_NAME}"
> table=MyTable
> DECLARE_STATEMENTS=($(mysql ${COM_LINE} -i -e"use ${DB}; SELECT defaults FROM
> "${table}" WHERE 1;"))
You're populating an array with each word (not
I apologize for asking this here; however, I cannot seem to locate an
answer anywhere else.
I am writing a script that will use MySQL for a back end. I access MySQL
and store the results in arrays like this:
//snippet//
database: MyDataBase
table: MyTable
field: defaults
Now, I have populated t