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

weird problems persist



Ok, I'm still seeing really weird behavior on my dual Opteron system
whenever I run a 64-bit kernel.  I've broken it down to some really
small shell scripts which demonstrate the problem.

It may be a bug in bash.

This code:

if [ `uname -s` = Linux ]; then
  echo "This is Linux."
else
  echo "This is not Linux."
fi

Will not run correctly when a 64-bit kernel is loaded if the script
is run from disk.  If it is typed interactively, it works fine.

mastermind% if [ `uname -s` = Linux ]; then
>   echo "This is Linux."
> else
>   echo "This is not Linux."
> fi
This is Linux.
mastermind% cat testshell.sh 
if [ `uname -s` = Linux ]; then
  echo "This is Linux."
else
  echo "This is not Linux."
fi
mastermind% source testshell.sh 
-bash: [: too many arguments
This is not Linux.
mastermind% 

For some reason, the `uname -s` expands to "Linux Linux" when the
script is sourced, but only "Linux" on the command line.

mastermind% set -x
mastermind% source testshell.sh 
+ source testshell.sh
+++ uname -s
++ '[' Linux Linux = Linux ']'
-bash: [: too many arguments
++ echo 'This is not Linux.'
This is not Linux.

When running a 32-bit kernel, it always expands to "Linux".

Can anyone else duplicate this?  I'm running bash 2.05b-12.

Eric



Reply to: