LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Closed Thread
 
Search this Thread
Old 09-04-2010, 03:46 AM   #1
imrrann
LQ Newbie
 
Registered: Sep 2010
Posts: 8

Rep: Reputation: 0
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
 
Old 09-04-2010, 03:52 AM   #2
TheIndependentAquarius
Senior Member
 
Registered: Dec 2008
Posts: 4,622
Blog Entries: 29

Rep: Reputation: 896Reputation: 896Reputation: 896Reputation: 896Reputation: 896Reputation: 896Reputation: 896
http://www.linuxquestions.org/questi...preter-829929/
 
Old 09-04-2010, 06:45 AM   #3
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 713Reputation: 713Reputation: 713Reputation: 713Reputation: 713Reputation: 713Reputation: 713
Quote:
Originally Posted by imrrann View Post
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.
 
Old 09-05-2010, 01:42 AM   #4
r_s
Member
 
Registered: May 2009
Distribution: slackware, fedora, ubuntu
Posts: 94

Rep: Reputation: 21
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.
 
1 members found this post helpful.
Old 09-05-2010, 03:50 PM   #5
imrrann
LQ Newbie
 
Registered: Sep 2010
Posts: 8

Original Poster
Rep: Reputation: 0
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
 
Old 09-05-2010, 04:27 PM   #6
TB0ne
Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 14,405

Rep: Reputation: 2529Reputation: 2529Reputation: 2529Reputation: 2529Reputation: 2529Reputation: 2529Reputation: 2529Reputation: 2529Reputation: 2529Reputation: 2529Reputation: 2529
Quote:
Originally Posted by imrrann View Post
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
 
Old 09-06-2010, 01:02 AM   #7
TheIndependentAquarius
Senior Member
 
Registered: Dec 2008
Posts: 4,622
Blog Entries: 29

Rep: Reputation: 896Reputation: 896Reputation: 896Reputation: 896Reputation: 896Reputation: 896Reputation: 896
Quote:
Originally Posted by imrrann View Post
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
 
Old 09-07-2010, 01:26 AM   #8
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,972
Blog Entries: 11

Rep: Reputation: 876Reputation: 876Reputation: 876Reputation: 876Reputation: 876Reputation: 876Reputation: 876
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
 
  


Closed Thread

Tags
command, ls


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to implement ls command in c? nehapawar Linux - Newbie 4 02-16-2010 05:21 PM
Implement a Unix Shell with History Feature vipin_jss Linux - Newbie 2 05-07-2009 07:38 PM
how to implement suspended job handling of a shell using c chrislam Programming 1 09-19-2007 11:43 AM
How to implement ldd command logic nileshbaviskar Programming 2 04-04-2007 02:52 AM
Shell implement in c SatYr_84 Programming 8 10-06-2005 12:44 AM


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

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration