?
Solved

bash: ÿ#!/bin/sh: on ubuntu

Posted on 2009-04-28
19
Medium Priority
?
624 Views
Last Modified: 2013-11-15
Hi guys,
I am a newbie to linux
I have installed ubuntu on my PC
I tried to run this command i got an error
user@PC1:~/mapnik$ source set-mapnik-env
bash: ÿ#!/bin/sh: No such file or directory,
someone told me: "Your error message is probably because it doesnt understand source "
another one told me:"Your Linuxseems to be missing the shell. On most distros this
is just a symlink to /bin/bash.
You have 3 options at this point.

a) Install sh
b) symlink /bin/bash to /bin/sh (quite safe, because bash can do
everything sh can, and will even behave more like sh when called as /bin/sh)
c) edit all the shellscripts in mapnik to use #!/bin/bash in the first
line instead of #!/bin/sh
"

still i didnt understand how to fix the problem
please ask for more details if u like
thanks
0
Comment
Question by:klay8
19 Comments
 
LVL 85

Expert Comment

by:ozo
ID: 24256132
Do you have an extra character at the beginning of  set-mapnik-env?
0
 

Author Comment

by:klay8
ID: 24256176
no that's it:  source set-mapnik-env
0
 

Author Comment

by:klay8
ID: 24256181
is "source" a linux command?
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
LVL 85

Expert Comment

by:ozo
ID: 24256216
source is a bash command
what is in the set-mapnik-env file
0
 

Author Comment

by:klay8
ID: 24256295

ÿ#!/bin/sh
#-----------------------------------------------------------------------------
#
#  set-mapnik-env
#
#  In this file several environment variables needed for creating OSM maps
#  with Mapnik are set.
#
#  Create a local copy of this file and customize the definitions for your
#  needs.
#
#-----------------------------------------------------------------------------
#
#  Every time you want to do some Mapnik rendering, source this file
#  from the shell:
#
#    source set-mapnik-env
#
#  or call other Mapnik scripts through this script:
#
#    set-mapnik-env customize-mapnik-map >osm.xml
#    set-mapnik-env generate_image.py
#    set-mapnik-env generate_tiles.py
#
#  Note that it is NOT enough to run this like this:
#    ./set-mapnik-env
#    sudo ./generate_image.py
#
#-----------------------------------------------------------------------------
 
# This is the name of the *local* version of the Mapnik map file after it has
# been run through the cutomize-mapnik-map script.
export MAPNIK_MAP_FILE=~/mapnik/osm.xml
 
# This is the directory where the icons and symbols for Mapnik are. If
# you have checked out the OSM subversion directory into a directory
# called ~/svn.openstreetmap.org, the symbols will be in
# ~/svn.openstreetmap.org/applications/rendering/mapnik/symbols
export MAPNIK_SYMBOLS_DIR=~/mapnik/symbols
 
# This is the directory where you upacked the world_boundaries.tar.bz2
# file you got from
# http://artem.dev.openstreetmap.org/files/world_boundaries.tar.bz2
export MAPNIK_WORLD_BOUNDARIES_DIR=~/mapnik/world_boundaries
 
# Directory where the created map tiles should be stored. Must end with
# a slash (/)
export MAPNIK_TILE_DIR=~/mapnik/tiles/
 
# This is the name of the server running the PostgreSQL database. Leave
# this empty if your database is on the local machine.
export MAPNIK_DBHOST=""
 
# This is the TCP port where the PostgreSQL server is listening. The
# default port for PostgreSQL is 5432. Leave this empty if your database
# is on the local machine.
export MAPNIK_DBPORT=""
 
# This is the name of the database where the OSM data is stored.
export MAPNIK_DBNAME='gis'
 
# This is the username we should use to log into the PostgreSQL database.
export MAPNIK_DBUSER=`whoami`
 
# This is the password we should use to log into the PostgreSQL database.
export MAPNIK_DBPASS=""
 
# This is the prefix used in the table names. Matches the -p option in osm2pgsql
# Unspecified defaults to "planet_osm"
export MAPNIK_PREFIX=""
 
#-----------------------------------------------------------------------------
# If there was any program name given on the command line, we call it now.
$*
 
#-----------------------------------------------------------------------------

Open in new window

0
 
LVL 85

Expert Comment

by:ozo
ID: 24256332
Remove the y in front of the #!/bin/sh
0
 
LVL 85

Expert Comment

by:ozo
ID: 24256333
Remove the ÿ in front of the #!/bin/sh
0
 

Author Comment

by:klay8
ID: 24256369
there is no "Y"  it only #!/bin/sh
 i dont that "y" that one appeared here
0
 
LVL 85

Expert Comment

by:ozo
ID: 24256385
http:#a24256295 shows a ÿ there
the error message is also symptomatic of an extraneous ÿ
0
 

Author Comment

by:klay8
ID: 24256418
do i remove #! ??
0
 
LVL 85

Expert Comment

by:ozo
ID: 24256435
leave the #!
remove the ÿ character in front of the #!
0
 

Author Comment

by:klay8
ID: 24256469

ÿ#!/bin/sh
#-----------------------------------------------------------------------------
#
#  set-mapnik-env
#
#  In this file several environment variables needed for creating OSM maps
#  with Mapnik are set.
#
#  Create a local copy of this file and customize the definitions for your
#  needs.
#
#-----------------------------------------------------------------------------
#
#  Every time you want to do some Mapnik rendering, source this file
#  from the shell:
#
#    source set-mapnik-env
#
#  or call other Mapnik scripts through this script:
#
#    set-mapnik-env customize-mapnik-map >osm.xml
#    set-mapnik-env generate_image.py
#    set-mapnik-env generate_tiles.py
#
#  Note that it is NOT enough to run this like this:
#    ./set-mapnik-env
#    sudo ./generate_image.py
#
#-----------------------------------------------------------------------------
 
# This is the name of the *local* version of the Mapnik map file after it has
# been run through the cutomize-mapnik-map script.
export MAPNIK_MAP_FILE=~/mapnik/osm.xml
 
# This is the directory where the icons and symbols for Mapnik are. If
# you have checked out the OSM subversion directory into a directory
# called ~/svn.openstreetmap.org, the symbols will be in
# ~/svn.openstreetmap.org/applications/rendering/mapnik/symbols
export MAPNIK_SYMBOLS_DIR=~/mapnik/symbols
 
# This is the directory where you upacked the world_boundaries.tar.bz2
# file you got from
# http://artem.dev.openstreetmap.org/files/world_boundaries.tar.bz2
export MAPNIK_WORLD_BOUNDARIES_DIR=~/mapnik/world_boundaries
 
# Directory where the created map tiles should be stored. Must end with
# a slash (/)
export MAPNIK_TILE_DIR=~/mapnik/tiles/
 
# This is the name of the server running the PostgreSQL database. Leave
# this empty if your database is on the local machine.
export MAPNIK_DBHOST=""
 
# This is the TCP port where the PostgreSQL server is listening. The
# default port for PostgreSQL is 5432. Leave this empty if your database
# is on the local machine.
export MAPNIK_DBPORT=""
 
# This is the name of the database where the OSM data is stored.
export MAPNIK_DBNAME='gis'
 
# This is the username we should use to log into the PostgreSQL database.
export MAPNIK_DBUSER=`whoami`
 
# This is the password we should use to log into the PostgreSQL database.
export MAPNIK_DBPASS=""
 
# This is the prefix used in the table names. Matches the -p option in osm2pgsql
# Unspecified defaults to "planet_osm"
export MAPNIK_PREFIX=""
 
#-----------------------------------------------------------------------------
# If there was any program name given on the command line, we call it now.
$*
 
#-----------------------------------------------------------------------------

Open in new window

0
 

Author Comment

by:klay8
ID: 24256472
it's the expert website who create the Y

i dont have Y on my file
0
 
LVL 85

Accepted Solution

by:
ozo earned 1800 total points
ID: 24256506
what do you see if you do
od -c set-mapnik-env | head
0
 
LVL 7

Assisted Solution

by:martin_2110
martin_2110 earned 200 total points
ID: 24256522
delete the line and retype it.
#!/bin/sh
0
 

Author Comment

by:klay8
ID: 24256558

od -c set-mapnik-env | head
0000000 357 273 277   #   !   /   b   i   n   /   s   h  \n   #   -   -
0000020   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
*
0000120   -   -   -   -   -   -   -   -   -   -   -  \n   #  \n   #    
0000140       s   e   t   -   m   a   p   n   i   k   -   e   n   v  \n
0000160   #  \n   #           I   n       t   h   i   s       f   i   l
0000200   e       s   e   v   e   r   a   l       e   n   v   i   r   o
0000220   n   m   e   n   t       v   a   r   i   a   b   l   e   s    
0000240   n   e   e   d   e   d       f   o   r       c   r   e   a   t
0000260   i   n   g       O   S   M       m   a   p   s  \n   #      

Open in new window

0
 
LVL 48

Expert Comment

by:Tintin
ID: 24257655
set-mapnik-env does have extraneous characters before the #!

You need to remove them.  Actually, you can remove the line

#!/bin/sh

altogether as it isn't relevant when you 'source' a file.
0
 
LVL 7

Expert Comment

by:mchkorg
ID: 24258110
Why don't you recreate this file with a copy-paste without the first 3-bytes character ?

* cat set-mapnik-env
* copy everything but the first strange Y
* edit new-set-mapnik-env
* paste
* save
* mv new-set-mapnik-env set-mapnik-env

to be sure, use "od" again to check the first bytes


Question is: why is this file corrupted "by default"?
0
 

Author Closing Comment

by:klay8
ID: 31575717
Thanks Guys
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Suggested Courses
Course of the Month16 days, 17 hours left to enroll

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question