El mar 08 jul 2014 17:14:40 ECT, Diego Saravia escribió:
>> Cuando ejecuto un programa que escribí en bash que tiene en la primera
>> línea #!/bin/bash me bota el siguiente error;
>>
>> bash: ./programa.bash: /bin/bash^M: intérprete erróneo: No existe el
>> archivo o el directorio
>>
>> Si existe el archivo /bin/bash. ¿Por qué es que me da ese error?
>>
>
> me da espina el ^M parece un programa editado en MSDOS,
>
> podes mandarme programa.bash para que lo pruebe?

#!/bin/bash

# Copyright (C) 2012-2014 Quiliro Ordóñez
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public
# License along with this program.If not, see
# <http://www.gnu.org/licenses/>.
#
# InstantHobo.bash version 0.5.9


# This program installs Hobo stable version 2.1.0 on Trisquel 6.0.1
# distribution of the GNU operating system by installing Ruby version
# 1.9.3 and other binary software packages from the repository.


# Installation:
#
# Just download this file and save it as InstantHobo.bash . Then make it
# executable by typing:
# chmod +x InstantHobo.bash
# Run it by typing:
# ./InstantHobo.bash
# It will ask you for the current user password. It will work if the 
user
# is in the sudoers list.


# Note: If you want to remove all gems, before running this script type:
# sudo gem list | cut -d" " -f1 | xargs sudo gem uninstall -aIx


# This script has been untested on Trisquel 6.0.1 with Apache & Webmin
# web servers and with SQLite3, PostgreSQL & MySQL database engines.
# Have fun using and modifying it. Please send me your updates
# at quiliro [at] fsfla [dot] org so I can share them with others.
# Keep hacking!


echo "Updating package database"
sudo apt-get update
# Uncomment the following line if you want to update installed packages.
# sudo apt-get upgrade -y

echo
echo "Installing stable versions of Build utilities, Ruby"
echo " and Rubygems as well as the git versioning system"
sudo apt-get -y install build-essential libssl-dev libreadline-gplv2-dev
sudo apt-get -y install zlib1g-dev checkinstall nodejs ruby1.9.1-full 
git-core

# Uncomment the following 3 lines if you want to update installed gems.
# echo
# echo "Updating currently installed gems"
# sudo gem update

# Choosing the web server

echo
echo "Choose web server"
echo "------ --- ------"
echo "Choose one of the following webserver:"
echo
echo "[A]pache 2"
echo "[W]ebrick"

read webserver

case "$webserver" in

"A" | "a" )

echo "Installing Apache 2 Web server"
sudo apt-get -y install apache2
;;

"W" | "w" )

echo "Webrick Web server is always installed by Hobo"
;;

esac

# Choosing the database

echo
echo "Choose database"
echo "------ --------"
echo "Choose one of the following databases:"
echo
echo "[M]ySQL 5"
echo "[S]QLite 3"
echo "[P]ostgreSQL"

read database

case "$database" in

"M" | "m" )

echo
echo "Installing MySQL database management system server"
sudo apt-get -y install mysql-server libmysqlclient-dev 
libmysql-ruby1.9.1
echo "Installing MySQL gem"
sudo gem install mysql2
;;

"S" | "s" )

echo
echo "Installing SQLite 3 database management system server"
sudo apt-get -y install sqlite3 libsqlite3-dev
echo "Installing Sqlite3 gem"
sudo gem install sqlite3
;;


#
#
# When using PostgreSQL, the database requires to change:
# local   all             all                                     peer
# for:
# local   all             all                                     md5
# Also tried with changing to this:
# local   all             all                                     trust
# host    all             all             127.0.0.1/32            trust
#
# Then restart the database motor with:
# sudo service postgresql restart
# But it still has errors which I am currently correcting. I guess you 
have
# to create the user and the database first. But I have no experience 
with
# Hobo and PostgreSQL.

"P" | "p" )

echo
echo "Installing PostgreSQL database management system server"
sudo apt-get -y install postgresql postgresql-server-dev-9.1
echo "Installing PostgreSQL gem"
sudo gem install pg
;;

esac

echo
echo "Installing the Hobo gem"
sudo gem update
sudo gem install hobo
echo "You can create a new Hobo application with: "
echo "hobo new application_name --setup"
echo "You can remove it with: "
echo "rm -rf application_name"
echo "Happy hacking!"

# End of script

--
Saludos libres,
Quiliro Ordóñez
600 8579

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Lista de Correo Asociacion@listas.asle.ec
Visite http://listas.asle.ec/mailman/listinfo/asociacion
para modificar las opciones de suscripción (suscribirse, retirarse, etc).

Participa en las listas y próximo foro, como socio de ASLE 
http://www.asle.ec/portal2/node/7

Visita el canal IRC #asle en irc.freenode.org para consultas en tiempo real.

Todo mensaje que sea enviado a esta lista es público (especialmente los que 
contengan una nota de confidencialidad) y cualquiera puede hacer el uso que 
desee de él.

Responder a