One weird thing is that when I try to print out the elements in the paths array, it says there are atleast 9 but when I use sizeof(paths) I get 4... What could be the reason for this?
You are getting the size of the pointer, not the number of elements in the array.
The function has no idea of the number of valid elements in the paths array.
Use strcpy for the first, then strcat to append.
access returns -1 for error, non -1 for success.
X_OK as you want to know the file is executable.
Thank you so much... I followed your advice... And if I want to implement alias support for my command... do I have to add some extra lines to the code or do I just have to utilise the alias command?
Not exactly... But my book wants me and its not homework... :P And yeah, don't tell me the solution or anything. I want to implement it myself... I just want to know the meaning of that... thats it..