Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 5 Apr 2016 11:24:19 +0300
From:      Dmitry Sivachenko <trtrmitya@gmail.com>
To:        freebsd-emulation@freebsd.org
Subject:   Unable to exec scripts from Linuxator
Message-ID:  <17FB69FC-A46A-4373-AF93-B9240C6742EA@gmail.com>

next in thread | raw e-mail | index | archive | help

Hello,

I have a C program which uses system() to execute another program.  Program is compiled under Linux and I run it on fresh FreeBSD-10 using Linuxator.

system() fails if it tries to execute a script, not a binary:

$ cat test.c 
#include <stdlib.h>
#include <stdio.h>

void main() {
  int i = system("/tmp/t.sh");
  printf("i=%d\n", i);
}
$ cat /tmp/t.sh
#!/usr/bin/env bash

echo "OK"
$

Compile test.c on Linux and run on FreeBSD:

$ ./a.out 
/compat/linux/usr/bin/env: h: No such file or directory
i=32512
$


Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?17FB69FC-A46A-4373-AF93-B9240C6742EA>