C code for a mini shell
my Assignment is to
write a a program which takes input from user . then modify the program enabling to check the contents of a directory now modify it to check if the input string is present in the \bin or \sbin directory |
Great - what have you tried so far and what problems are you having? No one on this forum is going to do your homework for you, but we may be able to help if you give it an honest effort and run into trouble. One thing to note, the *nix path separator is a forward slash, not a backslash as in DOS, so it's not \bin and \sbin but rather /bin and /sbin.
|
i am completely new to linux C programming and i m searching how can i start , just found this forum and registered here . maybe someone will help me getting starts . and sorry for the slash as you guys can understand how it feels when you dont have a clue about the thing you will have to work with .
|
Have you read through the rules for the forums? This is one of the points:
Quote:
Like btmiller said, post what you have tried first and then we can help. Noone will write it for you. |
The getting user input is easy, you should already know how to do that, and you probably have more details on exactly what is required.
As for the directory listing, this is not part of the standard C library, so you will either have to: 1) Use the 'system()' function to execute the right command. http://www.cplusplus.com/reference/cstdlib/system/ 2) Use glib: https://developer.gnome.org/glib/2.4...tml#g-dir-open |
Usually a "real" Unix shell like bash would use stat(2) or one of its variants to check and see if a file exists somewhere in its $PATH.
To the OP - if this is homework you must be taking a class. Did your lectures not cover what you need to know to complete the assignment? If not, maybe you should seek clarification from your professor... |
Maybe glibc opendir(), readdir()..?
|
All times are GMT -5. The time now is 05:11 AM. |