ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

unexpected EOF

asked 2020-03-28 12:22:56 -0500

dinesh gravatar image

updated 2020-03-28 12:23:43 -0500

when i run cmd "source ~/.bashrc" i'm getting below error:

bash: /tmp/setup.sh.FUf31G670r: line 38: unexpected EOF while looking for matching `"' bash: /tmp/setup.sh.FUf31G670r: line 39: syntax error: unexpected end of file bash: [: 0: unary operator expected

my /opt/ros/melodic/setup.sh file is:

#!/usr/bin/env sh
# generated from catkin/cmake/template/setup.sh.in

# Sets various environment variables and sources additional environment hooks.
# It tries it's best to undo changes from a previously sourced setup file before.
# Supported command line options:
# --extend: skips the undoing of changes from a previously sourced setup file
# --local: only considers this workspace but not the chained ones
# In plain sh shell which doesn't support arguments for sourced scripts you can
# set the environment variable `CATKIN_SETUP_UTIL_ARGS=--extend/--local` instead.

# since this file is sourced either use the provided _CATKIN_SETUP_DIR
# or fall back to the destination set at configure time
: ${_CATKIN_SETUP_DIR:=/opt/ros/melodic}
_SETUP_UTIL="$_CATKIN_SETUP_DIR/_setup_util.py"
unset _CATKIN_SETUP_DIR

if [ ! -f "$_SETUP_UTIL" ]; then
  echo "Missing Python script: $_SETUP_UTIL"
  return 22
fi

# detect if running on Darwin platform
_UNAME=`uname -s`
_IS_DARWIN=0
if [ "$_UNAME" = "Darwin" ]; then
  _IS_DARWIN=1
fi
unset _UNAME

# make sure to export all environment variables
export CMAKE_PREFIX_PATH
if [ $_IS_DARWIN -eq 0 ]; then
  export LD_LIBRARY_PATH
else
  export DYLD_LIBRARY_PATH
fi
unset _IS_DARWIN
export PATH
export PKG_CONFIG_PATH
export PYTHONPATH

# remember type of shell if not already set
if [ -z "$CATKIN_SHELL" ]; then
  CATKIN_SHELL=sh
fi

# invoke Python script to generate necessary exports of environment variables
# use TMPDIR if it exists, otherwise fall back to /tmp
if [ -d "${TMPDIR:-}" ]; then
  _TMPDIR="${TMPDIR}"
else
  _TMPDIR=/tmp
fi
_SETUP_TMP=`mktemp "${_TMPDIR}/setup.sh.XXXXXXXXXX"`
unset _TMPDIR
if [ $? -ne 0 -o ! -f "$_SETUP_TMP" ]; then
  echo "Could not create temporary file: $_SETUP_TMP"
  return 1
fi
CATKIN_SHELL=$CATKIN_SHELL "$_SETUP_UTIL" $@ ${CATKIN_SETUP_UTIL_ARGS:-} >> "$_SETUP_TMP"
_RC=$?
if [ $_RC -ne 0 ]; then
  if [ $_RC -eq 2 ]; then
    echo "Could not write the output of '$_SETUP_UTIL' to temporary file '$_SETUP_TMP': may be the disk if full?"
  else
    echo "Failed to run '\"$_SETUP_UTIL\" $@': return code $_RC"
  fi
  unset _RC
  unset _SETUP_UTIL
  rm -f "$_SETUP_TMP"
  unset _SETUP_TMP
  return 1
fi
unset _RC
unset _SETUP_UTIL
. "$_SETUP_TMP"
rm -f "$_SETUP_TMP"
unset _SETUP_TMP

# source all environment hooks
_i=0
while [ $_i -lt $_CATKIN_ENVIRONMENT_HOOKS_COUNT ]; do
  eval _envfile=\$_CATKIN_ENVIRONMENT_HOOKS_$_i
  unset _CATKIN_ENVIRONMENT_HOOKS_$_i
  eval _envfile_workspace=\$_CATKIN_ENVIRONMENT_HOOKS_${_i}_WORKSPACE
  unset _CATKIN_ENVIRONMENT_HOOKS_${_i}_WORKSPACE
  # set workspace for environment hook
  CATKIN_ENV_HOOK_WORKSPACE=$_envfile_workspace
  . "$_envfile"
  unset CATKIN_ENV_HOOK_WORKSPACE
  _i=$((_i + 1))
done
unset _i


unset _CATKIN_ENVIRONMENT_HOOKS_COUNT
edit retag flag offensive close merge delete

Comments

You've already found #q341021. Have you made sure there are no unexpected / illegal characters in your ENV variables?

gvdhoorn gravatar image gvdhoorn  ( 2020-03-29 04:41:25 -0500 )edit

well i chechek /opt/ros/melodic/setup.sh + setup.bash and also /tmp/setup.sh.XnS0zM0A6z but no i couldn't find. cas of this error i'm not able to use ros anymore.

dinesh gravatar image dinesh  ( 2020-03-29 05:09:20 -0500 )edit

1 Answer

Sort by » oldest newest most voted
1

answered 2020-03-29 05:14:03 -0500

gvdhoorn gravatar image

The problem is in your ENV vars. Not in the scripts.

Check the output of env. Specifically the variables LC_ALL, PATH and LC_CTYPE. But all the others as well of course. They should not contain any unbalanced quotes ('), double quotes (") or commas.

edit flag offensive delete link more

Comments

ok. thanks. i edited the /etc/environment file and removed the double quotes from the path variable and its working.

dinesh gravatar image dinesh  ( 2020-03-29 06:06:07 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2020-03-28 12:22:56 -0500

Seen: 957 times

Last updated: Mar 28 '20