LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Creating a shell using C which could Implement LS command (http://www.linuxquestions.org/questions/linux-newbie-8/creating-a-shell-using-c-which-could-implement-ls-command-830282/)

imrrann 09-04-2010 03:46 AM

Creating a shell using C which could Implement LS command
 
Dear Experts

I would like to create the shell which would support the LS command in C++.
And the way the command prompt can be changed.
Any help is highly appreciated


Regards

TheIndependentAquarius 09-04-2010 03:52 AM

http://www.linuxquestions.org/questi...preter-829929/

MTK358 09-04-2010 06:45 AM

Quote:

Originally Posted by imrrann (Post 4087714)
Dear Experts

I would like to create the shell which would support the LS command in C++.
And the way the command prompt can be changed.
Any help is highly appreciated


Regards

The ls command is an executable in the $PATH (usually /bin/ls), it's not built into the shell.

r_s 09-05-2010 01:42 AM

There are built-in libraries in C++ that you can use to emulate a shell which supports basic commands like ls and it's other options.

imrrann 09-05-2010 03:50 PM

Dear All

I have prohibited to use system or exec family of commands for implementing LS in my shell using C.
Any function which would return the names of files and sub-directories in the current working directory

THanks

TB0ne 09-05-2010 04:27 PM

Quote:

Originally Posted by imrrann (Post 4088878)
Dear All
I have prohibited to use system or exec family of commands for implementing LS in my shell using C.
Any function which would return the names of files and sub-directories in the current working directory

Ok. You've told us what you WANT, but not what you've DONE. What have you tried? And the fact that you say you can't use system or exec calls is telling...that almost shouts that this is homework.

Did you bother to try to look this up? Google for it? Do ANYTHING?
From a 10 second Google search:
http://snippets.dzone.com/posts/show/5734

TheIndependentAquarius 09-06-2010 01:02 AM

Quote:

Originally Posted by imrrann (Post 4088878)
I have prohibited to use system or exec family of commands for implementing LS in my shell using C.

When you post a question, do bother to post all the restrictions that are imposed w.r.t solving the question.

Check this post/thread:
http://www.linuxquestions.org/questi...6/#post1079538

Tinkster 09-07-2010 01:26 AM

And since you've fired off yet another thread on the same
topic (in an admittedly better suited forum) I'll close this
one, and issue yet another warning for you.


http://www.linuxquestions.org/questi...d-in-c-830563/

Just making this clear - you're not making friends with
your behaviour on the boards.


Cheers,
Tink


All times are GMT -5. The time now is 12:13 AM.