SlideShare a Scribd company logo
1 of 1
Download to read offline
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 showcaseLevis 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 verQrembiezs Intruder
 
Real World Haskell: Lecture 1
Real World Haskell: Lecture 1Real World Haskell: Lecture 1
Real World Haskell: Lecture 1Bryan O'Sullivan
 
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 hacksAbdullah Khosa
 
NYPHP March 2009 Presentation
NYPHP March 2009 PresentationNYPHP March 2009 Presentation
NYPHP March 2009 Presentationbrian_dailey
 
11 unix osx_commands
11 unix osx_commands11 unix osx_commands
11 unix osx_commandsMacinfosoft
 
Behat - Drupal South 2018
Behat  - Drupal South 2018Behat  - Drupal South 2018
Behat - Drupal South 2018Berend de Boer
 
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 LinuxJohn425873
 
Batch file programming
Batch file programmingBatch file programming
Batch file programmingalan moreno
 
Batch file-programming
Batch file-programmingBatch file-programming
Batch file-programmingjamilur
 
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 securityCESAR 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.pdfforecastfashions
 
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.pdfforecastfashions
 
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.pdfforecastfashions
 
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 .pdfforecastfashions
 
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.pdfforecastfashions
 
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 .pdfforecastfashions
 
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.pdfforecastfashions
 
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.pdfforecastfashions
 
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.pdfforecastfashions
 
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.pdfforecastfashions
 
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 .pdfforecastfashions
 
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.pdfforecastfashions
 
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.pdfforecastfashions
 
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.pdfforecastfashions
 
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.pdfforecastfashions
 
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 .pdfforecastfashions
 
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.pdfforecastfashions
 
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 .pdfforecastfashions
 
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.pdfforecastfashions
 
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.pdfforecastfashions
 

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

How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17Celine George
 
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...Nguyen Thanh Tu Collection
 
Improved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppImproved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppCeline George
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文中 央社
 
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...Nguyen Thanh Tu Collection
 
SPLICE Working Group: Reusable Code Examples
SPLICE Working Group:Reusable Code ExamplesSPLICE Working Group:Reusable Code Examples
SPLICE Working Group: Reusable Code ExamplesPeter Brusilovsky
 
How to Manage Website in Odoo 17 Studio App.pptx
How to Manage Website in Odoo 17 Studio App.pptxHow to Manage Website in Odoo 17 Studio App.pptx
How to Manage Website in Odoo 17 Studio App.pptxCeline George
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxannathomasp01
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...EADTU
 
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjMohammed Sikander
 
How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17Celine George
 
male presentation...pdf.................
male presentation...pdf.................male presentation...pdf.................
male presentation...pdf.................MirzaAbrarBaig5
 
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...MysoreMuleSoftMeetup
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project researchCaitlinCummins3
 
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽中 央社
 

Recently uploaded (20)

How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17
 
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
 
Improved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppImproved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio App
 
Mattingly "AI & Prompt Design: Named Entity Recognition"
Mattingly "AI & Prompt Design: Named Entity Recognition"Mattingly "AI & Prompt Design: Named Entity Recognition"
Mattingly "AI & Prompt Design: Named Entity Recognition"
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
 
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
 
SPLICE Working Group: Reusable Code Examples
SPLICE Working Group:Reusable Code ExamplesSPLICE Working Group:Reusable Code Examples
SPLICE Working Group: Reusable Code Examples
 
VAMOS CUIDAR DO NOSSO PLANETA! .
VAMOS CUIDAR DO NOSSO PLANETA!                    .VAMOS CUIDAR DO NOSSO PLANETA!                    .
VAMOS CUIDAR DO NOSSO PLANETA! .
 
How to Manage Website in Odoo 17 Studio App.pptx
How to Manage Website in Odoo 17 Studio App.pptxHow to Manage Website in Odoo 17 Studio App.pptx
How to Manage Website in Odoo 17 Studio App.pptx
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
 
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
 
How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17
 
Mattingly "AI and Prompt Design: LLMs with NER"
Mattingly "AI and Prompt Design: LLMs with NER"Mattingly "AI and Prompt Design: LLMs with NER"
Mattingly "AI and Prompt Design: LLMs with NER"
 
male presentation...pdf.................
male presentation...pdf.................male presentation...pdf.................
male presentation...pdf.................
 
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
 
Including Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdfIncluding Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdf
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project research
 
Supporting Newcomer Multilingual Learners
Supporting Newcomer  Multilingual LearnersSupporting Newcomer  Multilingual Learners
Supporting Newcomer Multilingual Learners
 
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
 

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,