SlideShare a Scribd company logo
Hello!
I'm trying to build a command line interpreter simulator using C programming language,
working in the linux environment. I don't want to get in to designing the whole thing, I just want
a little help with a particular problem. This particular problem is how do I write a line or lines in
C that will run a command as if I had typed it in the terminal? More specifically, the command
I'm trying to run is "help." The command that shows all available commands.
So for example, I want to simulate the "ls" command, the command that lists the content of the
current directory. I would go into my editor and type this:
#include
#include
int main()
{
system("ls");
return 0;
}
Now if I go into the terminal, compile that program and run it, it'll display the content of the
current directory as would simply typing in "ls" in the terminal. The problem is, I can't manage
to do the same for the "help" command. After researching a bit, I've found that the sh shell is
looking in /bin and /usr/bin to execute "help." However, that command is in neither directory
and will ultimately let me know that the command is "not found." If it's not in the earlier
mentioned directories, then where could it be? Is it even possible to run "help" within a C
program?
Sorry if it's a little long, I just wanted to be as clear as I can be. Any help would be greatly
appreciated!
Solution
you need to us ,
system ("/bin/ls");
Below is the update
*******************************************************
Also , you can use the below program to list the directories,

More Related Content

Similar to Hello!Im trying to build a command line interpreter simulator us.pdf

Reverse Engineering in Linux - The tools showcase
Reverse Engineering in Linux - The tools showcaseReverse Engineering in Linux - The tools showcase
Reverse Engineering in Linux - The tools showcase
Levis Nickaster
 
Tutorial basic of c ++lesson 1 eng ver
Tutorial basic of c ++lesson 1 eng verTutorial basic of c ++lesson 1 eng ver
Tutorial basic of c ++lesson 1 eng ver
Qrembiezs Intruder
 
Real World Haskell: Lecture 1
Real World Haskell: Lecture 1Real World Haskell: Lecture 1
Real World Haskell: Lecture 1Bryan O'Sullivan
 
C++ for hackers
C++ for hackersC++ for hackers
C++ for hackers
Franciny Salles
 
His162013 140529214456-phpapp01
His162013 140529214456-phpapp01His162013 140529214456-phpapp01
His162013 140529214456-phpapp01Getachew Ganfur
 
21 command prompt tricks and hacks
21 command prompt tricks and hacks21 command prompt tricks and hacks
21 command prompt tricks and hacks
Abdullah Khosa
 
NYPHP March 2009 Presentation
NYPHP March 2009 PresentationNYPHP March 2009 Presentation
NYPHP March 2009 Presentation
brian_dailey
 
The basics of c programming
The basics of c programmingThe basics of c programming
The basics of c programming
Muhammed Thanveer M
 
11 unix osx_commands
11 unix osx_commands11 unix osx_commands
11 unix osx_commands
Macinfosoft
 
Words in Code
Words in CodeWords in Code
Words in Code
Pete Goodliffe
 
Behat - Drupal South 2018
Behat  - Drupal South 2018Behat  - Drupal South 2018
Behat - Drupal South 2018
Berend de Boer
 
Cordovilla
CordovillaCordovilla
Cordovilla
brianmae002
 
C
CC
dotor.pdf
dotor.pdfdotor.pdf
dotor.pdf
JaveedAhamed7
 
How to run C Program in Linux
How to run C Program in LinuxHow to run C Program in Linux
How to run C Program in Linux
John425873
 
Batch file programming
Batch file programmingBatch file programming
Batch file programming
alan moreno
 
Batch file-programming
Batch file-programmingBatch file-programming
Batch file-programming
jamilur
 
Bash shell programming in linux
Bash shell programming in linuxBash shell programming in linux
Bash shell programming in linuxNorberto Angulo
 
C plus plus for hackers it security
C plus plus for hackers it securityC plus plus for hackers it security
C plus plus for hackers it security
CESAR A. RUIZ C
 

Similar to Hello!Im trying to build a command line interpreter simulator us.pdf (20)

Reverse Engineering in Linux - The tools showcase
Reverse Engineering in Linux - The tools showcaseReverse Engineering in Linux - The tools showcase
Reverse Engineering in Linux - The tools showcase
 
Tutorial basic of c ++lesson 1 eng ver
Tutorial basic of c ++lesson 1 eng verTutorial basic of c ++lesson 1 eng ver
Tutorial basic of c ++lesson 1 eng ver
 
Real World Haskell: Lecture 1
Real World Haskell: Lecture 1Real World Haskell: Lecture 1
Real World Haskell: Lecture 1
 
C++ for hackers
C++ for hackersC++ for hackers
C++ for hackers
 
His162013 140529214456-phpapp01
His162013 140529214456-phpapp01His162013 140529214456-phpapp01
His162013 140529214456-phpapp01
 
21 command prompt tricks and hacks
21 command prompt tricks and hacks21 command prompt tricks and hacks
21 command prompt tricks and hacks
 
NYPHP March 2009 Presentation
NYPHP March 2009 PresentationNYPHP March 2009 Presentation
NYPHP March 2009 Presentation
 
The basics of c programming
The basics of c programmingThe basics of c programming
The basics of c programming
 
11 unix osx_commands
11 unix osx_commands11 unix osx_commands
11 unix osx_commands
 
Words in Code
Words in CodeWords in Code
Words in Code
 
Behat - Drupal South 2018
Behat  - Drupal South 2018Behat  - Drupal South 2018
Behat - Drupal South 2018
 
Cordovilla
CordovillaCordovilla
Cordovilla
 
C
CC
C
 
dotor.pdf
dotor.pdfdotor.pdf
dotor.pdf
 
How to run C Program in Linux
How to run C Program in LinuxHow to run C Program in Linux
How to run C Program in Linux
 
Batch file programming
Batch file programmingBatch file programming
Batch file programming
 
Batch file-programming
Batch file-programmingBatch file-programming
Batch file-programming
 
Csharp_Chap01
Csharp_Chap01Csharp_Chap01
Csharp_Chap01
 
Bash shell programming in linux
Bash shell programming in linuxBash shell programming in linux
Bash shell programming in linux
 
C plus plus for hackers it security
C plus plus for hackers it securityC plus plus for hackers it security
C plus plus for hackers it security
 

More from forecastfashions

Identify the organ labelled 3.liverstomacht h e mesenteryjej.pdf
Identify the organ labelled 3.liverstomacht h e mesenteryjej.pdfIdentify the organ labelled 3.liverstomacht h e mesenteryjej.pdf
Identify the organ labelled 3.liverstomacht h e mesenteryjej.pdf
forecastfashions
 
Fahrenheit ToCelsiusValue.java Done Program name Fahrenheit To Celsiu.pdf
Fahrenheit ToCelsiusValue.java Done Program name Fahrenheit To Celsiu.pdfFahrenheit ToCelsiusValue.java Done Program name Fahrenheit To Celsiu.pdf
Fahrenheit ToCelsiusValue.java Done Program name Fahrenheit To Celsiu.pdf
forecastfashions
 
Explain the relationship between three aspects of science hypothesi.pdf
Explain the relationship between three aspects of science hypothesi.pdfExplain the relationship between three aspects of science hypothesi.pdf
Explain the relationship between three aspects of science hypothesi.pdf
forecastfashions
 
Did BP respond to the oil spill in a manner that was appropriate to .pdf
Did BP respond to the oil spill in a manner that was appropriate to .pdfDid BP respond to the oil spill in a manner that was appropriate to .pdf
Did BP respond to the oil spill in a manner that was appropriate to .pdf
forecastfashions
 
Consider the subset S = {0, 2, 4, 6, 8, 10, 12} of Z14Z. (a) Show t.pdf
Consider the subset S = {0, 2, 4, 6, 8, 10, 12} of Z14Z.  (a) Show t.pdfConsider the subset S = {0, 2, 4, 6, 8, 10, 12} of Z14Z.  (a) Show t.pdf
Consider the subset S = {0, 2, 4, 6, 8, 10, 12} of Z14Z. (a) Show t.pdf
forecastfashions
 
Assignment Description When dealing with a performance improvement .pdf
Assignment Description When dealing with a performance improvement .pdfAssignment Description When dealing with a performance improvement .pdf
Assignment Description When dealing with a performance improvement .pdf
forecastfashions
 
Answer ALL 2 QUESTIONS please.... You configured several time settin.pdf
Answer ALL 2 QUESTIONS please.... You configured several time settin.pdfAnswer ALL 2 QUESTIONS please.... You configured several time settin.pdf
Answer ALL 2 QUESTIONS please.... You configured several time settin.pdf
forecastfashions
 
A heritability of body weight of 0.4 means that body weight is deter.pdf
A heritability of body weight of 0.4 means that body weight is deter.pdfA heritability of body weight of 0.4 means that body weight is deter.pdf
A heritability of body weight of 0.4 means that body weight is deter.pdf
forecastfashions
 
After reading the Cultural Competency Module, reflect on your own co.pdf
After reading the Cultural Competency Module, reflect on your own co.pdfAfter reading the Cultural Competency Module, reflect on your own co.pdf
After reading the Cultural Competency Module, reflect on your own co.pdf
forecastfashions
 
A variable that consists of indivisible categories with no other sco.pdf
A variable that consists of indivisible categories with no other sco.pdfA variable that consists of indivisible categories with no other sco.pdf
A variable that consists of indivisible categories with no other sco.pdf
forecastfashions
 
C++ BinaryTree Help Creating main function for Trees...Here are .pdf
C++ BinaryTree Help  Creating main function for Trees...Here are .pdfC++ BinaryTree Help  Creating main function for Trees...Here are .pdf
C++ BinaryTree Help Creating main function for Trees...Here are .pdf
forecastfashions
 
Write a short essay explaining the four primary groups of production.pdf
Write a short essay explaining the four primary groups of production.pdfWrite a short essay explaining the four primary groups of production.pdf
Write a short essay explaining the four primary groups of production.pdf
forecastfashions
 
Why didnt the government just arrange to have excess food commodit.pdf
Why didnt the government just arrange to have excess food commodit.pdfWhy didnt the government just arrange to have excess food commodit.pdf
Why didnt the government just arrange to have excess food commodit.pdf
forecastfashions
 
Where is Virtual Reality going, and where would it be 20 yearsS.pdf
Where is Virtual Reality going, and where would it be 20 yearsS.pdfWhere is Virtual Reality going, and where would it be 20 yearsS.pdf
Where is Virtual Reality going, and where would it be 20 yearsS.pdf
forecastfashions
 
What is the negative side to overusing technical communication tools.pdf
What is the negative side to overusing technical communication tools.pdfWhat is the negative side to overusing technical communication tools.pdf
What is the negative side to overusing technical communication tools.pdf
forecastfashions
 
What is the method of action of aldehydes They damage proteins .pdf
What is the method of action of aldehydes  They damage proteins .pdfWhat is the method of action of aldehydes  They damage proteins .pdf
What is the method of action of aldehydes They damage proteins .pdf
forecastfashions
 
What are rubisco and RuBP And what do they do Briefly list 4 simil.pdf
What are rubisco and RuBP And what do they do  Briefly list 4 simil.pdfWhat are rubisco and RuBP And what do they do  Briefly list 4 simil.pdf
What are rubisco and RuBP And what do they do Briefly list 4 simil.pdf
forecastfashions
 
Virtual Machines Discuss what are the new innovation today in this .pdf
Virtual Machines Discuss what are the new innovation today in this .pdfVirtual Machines Discuss what are the new innovation today in this .pdf
Virtual Machines Discuss what are the new innovation today in this .pdf
forecastfashions
 
Using Java, please write the program for the following prompt in the.pdf
Using Java, please write the program for the following prompt in the.pdfUsing Java, please write the program for the following prompt in the.pdf
Using Java, please write the program for the following prompt in the.pdf
forecastfashions
 
True or FalseBecause IPsec is located in the IP layer, when it is.pdf
True or FalseBecause IPsec is located in the IP layer, when it is.pdfTrue or FalseBecause IPsec is located in the IP layer, when it is.pdf
True or FalseBecause IPsec is located in the IP layer, when it is.pdf
forecastfashions
 

More from forecastfashions (20)

Identify the organ labelled 3.liverstomacht h e mesenteryjej.pdf
Identify the organ labelled 3.liverstomacht h e mesenteryjej.pdfIdentify the organ labelled 3.liverstomacht h e mesenteryjej.pdf
Identify the organ labelled 3.liverstomacht h e mesenteryjej.pdf
 
Fahrenheit ToCelsiusValue.java Done Program name Fahrenheit To Celsiu.pdf
Fahrenheit ToCelsiusValue.java Done Program name Fahrenheit To Celsiu.pdfFahrenheit ToCelsiusValue.java Done Program name Fahrenheit To Celsiu.pdf
Fahrenheit ToCelsiusValue.java Done Program name Fahrenheit To Celsiu.pdf
 
Explain the relationship between three aspects of science hypothesi.pdf
Explain the relationship between three aspects of science hypothesi.pdfExplain the relationship between three aspects of science hypothesi.pdf
Explain the relationship between three aspects of science hypothesi.pdf
 
Did BP respond to the oil spill in a manner that was appropriate to .pdf
Did BP respond to the oil spill in a manner that was appropriate to .pdfDid BP respond to the oil spill in a manner that was appropriate to .pdf
Did BP respond to the oil spill in a manner that was appropriate to .pdf
 
Consider the subset S = {0, 2, 4, 6, 8, 10, 12} of Z14Z. (a) Show t.pdf
Consider the subset S = {0, 2, 4, 6, 8, 10, 12} of Z14Z.  (a) Show t.pdfConsider the subset S = {0, 2, 4, 6, 8, 10, 12} of Z14Z.  (a) Show t.pdf
Consider the subset S = {0, 2, 4, 6, 8, 10, 12} of Z14Z. (a) Show t.pdf
 
Assignment Description When dealing with a performance improvement .pdf
Assignment Description When dealing with a performance improvement .pdfAssignment Description When dealing with a performance improvement .pdf
Assignment Description When dealing with a performance improvement .pdf
 
Answer ALL 2 QUESTIONS please.... You configured several time settin.pdf
Answer ALL 2 QUESTIONS please.... You configured several time settin.pdfAnswer ALL 2 QUESTIONS please.... You configured several time settin.pdf
Answer ALL 2 QUESTIONS please.... You configured several time settin.pdf
 
A heritability of body weight of 0.4 means that body weight is deter.pdf
A heritability of body weight of 0.4 means that body weight is deter.pdfA heritability of body weight of 0.4 means that body weight is deter.pdf
A heritability of body weight of 0.4 means that body weight is deter.pdf
 
After reading the Cultural Competency Module, reflect on your own co.pdf
After reading the Cultural Competency Module, reflect on your own co.pdfAfter reading the Cultural Competency Module, reflect on your own co.pdf
After reading the Cultural Competency Module, reflect on your own co.pdf
 
A variable that consists of indivisible categories with no other sco.pdf
A variable that consists of indivisible categories with no other sco.pdfA variable that consists of indivisible categories with no other sco.pdf
A variable that consists of indivisible categories with no other sco.pdf
 
C++ BinaryTree Help Creating main function for Trees...Here are .pdf
C++ BinaryTree Help  Creating main function for Trees...Here are .pdfC++ BinaryTree Help  Creating main function for Trees...Here are .pdf
C++ BinaryTree Help Creating main function for Trees...Here are .pdf
 
Write a short essay explaining the four primary groups of production.pdf
Write a short essay explaining the four primary groups of production.pdfWrite a short essay explaining the four primary groups of production.pdf
Write a short essay explaining the four primary groups of production.pdf
 
Why didnt the government just arrange to have excess food commodit.pdf
Why didnt the government just arrange to have excess food commodit.pdfWhy didnt the government just arrange to have excess food commodit.pdf
Why didnt the government just arrange to have excess food commodit.pdf
 
Where is Virtual Reality going, and where would it be 20 yearsS.pdf
Where is Virtual Reality going, and where would it be 20 yearsS.pdfWhere is Virtual Reality going, and where would it be 20 yearsS.pdf
Where is Virtual Reality going, and where would it be 20 yearsS.pdf
 
What is the negative side to overusing technical communication tools.pdf
What is the negative side to overusing technical communication tools.pdfWhat is the negative side to overusing technical communication tools.pdf
What is the negative side to overusing technical communication tools.pdf
 
What is the method of action of aldehydes They damage proteins .pdf
What is the method of action of aldehydes  They damage proteins .pdfWhat is the method of action of aldehydes  They damage proteins .pdf
What is the method of action of aldehydes They damage proteins .pdf
 
What are rubisco and RuBP And what do they do Briefly list 4 simil.pdf
What are rubisco and RuBP And what do they do  Briefly list 4 simil.pdfWhat are rubisco and RuBP And what do they do  Briefly list 4 simil.pdf
What are rubisco and RuBP And what do they do Briefly list 4 simil.pdf
 
Virtual Machines Discuss what are the new innovation today in this .pdf
Virtual Machines Discuss what are the new innovation today in this .pdfVirtual Machines Discuss what are the new innovation today in this .pdf
Virtual Machines Discuss what are the new innovation today in this .pdf
 
Using Java, please write the program for the following prompt in the.pdf
Using Java, please write the program for the following prompt in the.pdfUsing Java, please write the program for the following prompt in the.pdf
Using Java, please write the program for the following prompt in the.pdf
 
True or FalseBecause IPsec is located in the IP layer, when it is.pdf
True or FalseBecause IPsec is located in the IP layer, when it is.pdfTrue or FalseBecause IPsec is located in the IP layer, when it is.pdf
True or FalseBecause IPsec is located in the IP layer, when it is.pdf
 

Recently uploaded

June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Atul Kumar Singh
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Po-Chuan Chen
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
CarlosHernanMontoyab2
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
DhatriParmar
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
Peter Windle
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
SACHIN R KONDAGURI
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
RaedMohamed3
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
timhan337
 

Recently uploaded (20)

June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
 

Hello!Im trying to build a command line interpreter simulator us.pdf

  • 1. Hello! I'm trying to build a command line interpreter simulator using C programming language, working in the linux environment. I don't want to get in to designing the whole thing, I just want a little help with a particular problem. This particular problem is how do I write a line or lines in C that will run a command as if I had typed it in the terminal? More specifically, the command I'm trying to run is "help." The command that shows all available commands. So for example, I want to simulate the "ls" command, the command that lists the content of the current directory. I would go into my editor and type this: #include #include int main() { system("ls"); return 0; } Now if I go into the terminal, compile that program and run it, it'll display the content of the current directory as would simply typing in "ls" in the terminal. The problem is, I can't manage to do the same for the "help" command. After researching a bit, I've found that the sh shell is looking in /bin and /usr/bin to execute "help." However, that command is in neither directory and will ultimately let me know that the command is "not found." If it's not in the earlier mentioned directories, then where could it be? Is it even possible to run "help" within a C program? Sorry if it's a little long, I just wanted to be as clear as I can be. Any help would be greatly appreciated! Solution you need to us , system ("/bin/ls"); Below is the update ******************************************************* Also , you can use the below program to list the directories,