Can you change the current working directory? If not, it's not a shell script.
$ cat bscript.sh && echo "---" && ./bscript.sh
#!/usr/bin/bash
cd testdir/
ls
---
dummyfile
in C you can change dir easily via `chdir()`[1] $ cat cscript && echo "---" && ./cscript
#!/usr/bin/tcc -run
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int main(void)
{
if (chdir("testdir") == -1) {
perror("chdir");
return EXIT_FAILURE;
}
execlp("ls", "ls", (char *)NULL);
perror("execlp");
return EXIT_FAILURE;
}
---
dummyfile
[1] https://www.man7.org/linux/man-pages/man2/chdir.2.htmlIf you meant somehow changing the parent shell's directory an ordinary bash script doesn't do that either
Or did you mean change the directory of the calling shell (in which case, executable shell scripts written in Bash and friends can’t do that either).