./ configure: / bin / sh^M: mal intérprete [duplicado]


Esta pregunta ya tiene una respuesta aquí:

He estado intentando instalar lpng142 en mi sistema fed 12. Me parece un problema. Me sale este error

[root@localhost lpng142]# ./configure
bash: ./configure: /bin/sh^M: bad interpreter: No such file or directory
[root@localhost lpng142]# 

¿Cómo soluciono esto? El archivo /etc/fstab:

#
# /etc/fstab
# Created by anaconda on Wed May 26 18:12:05 2010
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/VolGroup-lv_root /                       ext4    defaults        1 1
UUID=ce67cf79-22c3-45d4-8374-bd0075617cc8 /boot                   ext4    
defaults        1 2
/dev/mapper/VolGroup-lv_swap swap                    swap    defaults        0 0
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
Author: Konerak, 2010-05-27

15 answers

Para arreglar, abra su script con vi o vim e ingrese en vi command mode (key Esc ), luego escriba esto:

:set fileformat=unix

Finalmente salvarlo

:x! o :wq!

 618
Author: polymame,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-03-30 20:17:38

Parece que tiene un archivo de terminación de línea dos. La pista es el ^M.

Necesita volver a guardar el archivo usando finales de línea Unix.

Es posible que tenga una utilidad de línea de comandos dos2unix que también lo hará por usted.

 351
Author: Richard,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-12-12 14:49:49

O si quieres hacer esto con un script:

sed -i 's/\r//' filename
 74
Author: Somaiah Kumbera,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2012-06-13 16:14:28

Su archivo de configuración contiene finales de línea CRLF (estilo windows) en lugar de finales de línea LF simples (estilo unix). ¿Lo transfirió usando el modo FTP ASCII desde Windows?

Puedes usar

dos2unix configure

Para arreglar esto, o abrirlo en vi y usar :%s/^M//g; para sustituirlos a todos (use CTRL+V, CTRL+M para obtener el ^M)

 40
Author: Konerak,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-12-12 14:50:25

Puede usar el siguiente comando para arreglar

cat file_name.sh | tr -d '\r' > file_name.sh.new
 22
Author: wu liang,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-07-09 03:15:01

Si no se pudo encontrar ejecute el comando,

CentOS:

# yum install dos2unix*

# dos2unix filename.sh
dos2unix: converting file filename.sh to Unix format ...

Ubuntu / Debian:

# apt-get install dos2unix
 12
Author: lakshmikandan,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-07-28 09:25:22

Esto suele ocurrir cuando ha editado un archivo desde Windows y ahora intenta ejecutarlo desde alguna máquina basada en unix.

La solución presentada en Linux Forum funcionó para mí (muchas veces):

perl -i -pe's/\r$//;' <file name here>

Espero que esto ayude.

PD: necesita tener perl instalado en su máquina unix/linux.

 9
Author: URB,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-03-13 08:05:03

Si está en OS X, puede cambiar los finales de línea en XCode abriendo el archivo y seleccionando

Vista - > Texto - > Finales de línea - > Unix

Elemento de menú, luego Guardar. Esto es para XCode 3.x. Probablemente algo similar en XCode 4.

 4
Author: Vern Jensen,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2012-01-26 22:46:42

Siguiendo el comentario de Richard. Esta es la manera fácil de convertir su archivo a finales de línea UNIX. Si eres como yo lo creaste en el Bloc de notas de Windows y luego intentaste ejecutarlo en Linux-mala idea.

  1. Descargue e instale usted mismo una copia de Notepad++ (gratis).
  2. Abra su archivo de script en Notepad++.
  3. menú Archivo -> Guardar Como ->
  4. Guardar como tipo: Unix script file (*.sh;*.bsh)
  5. Copie el nuevo archivo. sh a su Linux sistema
  6. Maxe it ejecutable con: chmod 755 the_script_filename
  7. Ejecútalo con: ./the_script_filename

Cualquier otro problema pruebe este enlace.

 4
Author: zuallauz,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-02-04 10:31:36

Use el comando dos2unix en linux para convertir el archivo guardado. ejemplo :

dos2unix file_name
 4
Author: srpatcha,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-07-29 19:58:39

Gracias al comentario de pwc101 sobre este post, este comando funcionó en Kali Linux .

sed -i s/{ctrl+v}{ctrl+m}// {filename}

Asegúrese de reemplazar los bits entre paréntesis, {}. Es decir, {ctrl+m}significa presionar La tecla Ctrly la tecla M juntas.

 4
Author: br3nt,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-03-30 20:18:28

También puedes hacer esto en Kate.

  1. Abra el archivo
  2. Abra el menú Herramientas
  3. Expande el submenú Fin De Línea
  4. Select UNIX
  5. Guarda el archivo.
 3
Author: Tjaart,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-03-20 18:17:41

Si está utilizando TextMate o un programa similar, guarde como, y luego en codificaciones elija LF en lugar de CRLF.

 2
Author: patapouf_ai,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-03-08 11:00:52

Simplemente agregando sh antes del nombre del script lo hace funcionar en mi caso.

 2
Author: SkorpEN,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-08-28 11:39:24

Cuando escribe su script en el entorno windows y desea ejecutarlo en unix environnement, debe tener cuidado con la codificación:

Dos2unix $filePath

 1
Author: Youssouf Maiga,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-04-11 14:22:19