building a small shell like prog
i try to make cd command, so i use:
if (!strcmp(cmd, "cd") )
{
if(chdir("args[1]")!=0){
printf(" %s - path not found\n",args[1]);
perror("Error:");
}
}
the output is this:
smash > cd /home/johnny/workspace/
/home/johnny/workspace/ - path not found
Error:: No such file or directory
smash > cd test
test - path not found
Error:: No such file or directory
ps there is a "test" folder in the working dir
pps maybe you guys can help me on how to make "cd .." command