I have been reading a ton about bash scripts and program testing but I am still unable to make this code work.
Basically it is a simple program that asks the user for either of north east south or west. I start the program then it immediately asks for input. I just can not get the bash script to give it any input. I tried using echo and expect.
Any help is appreciated.
Here is the function used to get the players input:
int process_input(Map *game)
{
    printf("\n> ");
    char ch = getchar();
    char a = getchar(); //eat enter
    int damage = rand() % 4;
    switch(ch) {
        case -1:
            printf("you suck\n");
            return 0;
            break;
        case 'n':
            game->proto.move(game, NORTH);
            break;
        case 's':
            game->_(move)(game, SOUTH);
            break;
        case 'e':
            game->_(move)(game, EAST);
            break;
        case 'w':
            game->_(move)(game, WEST);
            break;
        case 'a':
            game->_(attack)(game, damage);
            break;
        case 'l':
                    printf("You can go:\n");
                    if(game->location->north) printf("NORTH\n");
                    if(game->location->south) printf("SOUTH\n");
                    if(game->location->east) printf("EAST\n");
                if(game->location->west) printf("WEST\n");
                    break;
        default:
            printf("Whats next?", ch);
        }
        return 1;
}
And here is the attempt at a bash script:
   #!/bin/bash
    /Desktop/c
    ./ex17 echo 'w'
 
     
     
     
    