October 22, 2024
Chicago 12, Melborne City, USA
C++

Why can I see the shell variable with argv?


So, I was testing something with argc and argv in C language, and i discovered this.

#include <stdio.h>

int main(int argc, char *argv[])
{
    printf(%s\n", argv[2]);
}

I compile it and rum this from my terminal like this ./a.out, and the result is SHELL=/bin/bash, my shell variable…
I use foot, the default terminal of sway.

I just want to know why. First time here by the way 🙂



You need to sign in to view this answers

Leave feedback about this

  • Quality
  • Price
  • Service

PROS

+
Add Field

CONS

+
Add Field
Choose Image
Choose Video