sh: 1: : not found when trying to open a new shell

2.8k views Asked by At

I am trying to get a shell but it either doesn't open one or it throws an error and gets stuck saying

^[[B^[[B^[[B^[[B^[[B^[[B^[[B^[[B^[[B
sh: 1: : not found

Below is the .c code

#include<stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <grp.h>
    
int main(void)
{
    setgid(0);
    setuid(0);
    execl("/bin/sh", "sh", 0);
}

Please help me out with this as I'm new to it.

0

There are 0 answers