File: test-execl.sh

package info (click to toggle)
pseudo 1.8.1%2Bgit20161012-2
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 1,804 kB
  • ctags: 927
  • sloc: ansic: 11,729; sh: 760; python: 749; makefile: 158
file content (21 lines) | stat: -rwxr-xr-x 364 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/bash
cat > execl_test.c << EOF
#include <unistd.h>
int main() {
        return execl("/usr/bin/env", "/usr/bin/env", "A=A", "B=B", "C=C", NULL);
}
EOF

gcc -o execl_test execl_test.c

./execl_test | grep -q "C=C"

if [ "$?" = "0" ]
then
    #echo "Passed."
    rm -f execl_test execl_test.c
    exit 0
fi
#echo "Failed"
rm -f execl_test execl_test.c
exit 1