This website uses cookies to ensure you have the best experience. Learn more

Program That Creates A Shell And Executes Some Shell Commands

709 words - 3 pages

/* myshell.c
Description: Program that creates a shell and executes some shell commands


extern char **getln();

// Function used to check the file input direction command
int inputFile(char **args, char **fileIn) {

int i,j;
//go thorough the command line arguments
for(i=0;args[i] != NULL;i++) {

// check for the input direction symbol
if(args[i][0] == '') {

// save the filename command
if(args[i+1] != NULL) {
*fileOut = args[i+1];

/*for(j=i;args[j-1] != NULL; j++) {
args[j] = args[j+2];
return 1;
return 0;

// The main function of the program responsible for creating the shell
main() {

// all the variables used in the programs functionality
int i;
char **args;
int status;
pid_t child;
int checkInput;
int checkOutput;

int flag =0;
char *fileOut;
char *fileIn;
int sum=0;

int num;
long convert;
int j;
int count=0;
int k;
int counter;
int checkProduct;

while(1) {

sum =0;
int argCount = 0;
args = getln();

// go through the loop and print all the command line arguments
for(i = 0; args[i] != NULL; i++) {
printf("Argument %d: %s\n", i, args[i]);

if(strcmp(args[0],"add") == 0) {

// convert the hex into decimal in roder to add it to sum for the add command
if(args[i][0] == '0' && (args[i][1] == 'x')) {
convert = strtol(args[i],NULL,16);
printf("The number is %ld \n", convert);
sum = sum + convert;

// check if it is a valid integer or not
num = atoi(args[i]);
if (num == 0) {
//printf("Number is: %i \n", num);
else {
sum = sum + num;

// check to see if there is arg or args command, if there is then print
// number of arguments and list them on the screen
if((strcmp(args[0],"arg") == 0) ||...

Find Another Essay On Program that creates a shell and executes some shell commands

Mobile Phone Industry In A Nut Shell

8983 words - 36 pages those on a digital network. In their latest report documented in April 2001, they realised that it was no longer appropriate to do this since 99% of individuals are on a digital network. Now their segmentation has taken the form of those with contract connections and those with pre pay lines.As a budding strategist, I feel that this approach to segmenting the market is in some ways product based as opposed to marketing orientated. The concept of

Shell Oil and the Exploitation of Nigeria

2206 words - 9 pages Shell Oil and the Exploitation of Nigeria      Nigeria has been a country in political turmoil for a long time. The country was created in 1914 under British colonial rule and at that time it was considered a protectorate. It was not until 1960 that Nigeria received independence from the United Kingdom. One of Nigeria's problems politically is that it has over three hundred different ethnic groups. The three largest

Transport Layer Security and Secure Shell

1420 words - 6 pages they depend upon a similar encryption algorithm for connection establishment. The initial connection is set up through asymmetric encryption and a symmetric session key is required to be transmitted so that quicker encryption of session related traffic can take place (Paw, 2012). There are however some differences between TLS and SSH. For instance, the authentication phase of TLS is optional and because TLS has the functionality of operating

Royal Dutch Shell: Globe Business and Ethics Paper

1025 words - 4 pages capitalize on a fashion for using them in interior design. His instinct was right - such was the demand that Samuel quickly began importing shells from the Far East, laying the foundations for his import/export business," (The beginning, para 1.). Shell Group's ultimate goal is to uphold their core values honesty, integrity, respect for people and its business principles that are applicable anywhere it does business.The ethical issues that became

Ocean acidity and shell degratuin - Science - Research paper

825 words - 4 pages  neutral pH level, or one that is the same as their natural environment, then no harm will be done to the shell. If a shell is placed in an acidic solution such as vinegar, then the shells will dissolve2. Methods and materials The untreated shells were first removed from their bags and labeled  "E" for experimental and "C" for control with a sharpie. The initial observations of the shells characteristics were then recorded into the data table and

Power Struggle Between the Sow's Head and Conch Shell

884 words - 4 pages decisions in the novel. People and societies give away too much power to objects and let them control their lives. The conch shell was an object that Ralph found in the lagoon and was used to call assemblies. The sow’s head is a pig’s head that was chopped off and put on to a stick for the "beast". The conch is a symbol of the powers involved with civilized leadership. In the beginning of the Lord of the Flies, the boys valued the conch and the

The Oil Reserves of Royal Dutch Shell: How Royal Dutch Shell has accounted for their oil reserves as a practise of looking for grey areas in Financial Accounting

2098 words - 8 pages . The standardised measure of discounted future cashflows, associated with proven reserves, is influenced negatively by the write-off by some 10%.95% of the reserves were booked as proved undeveloped reserves so Shell claims that the profits will be only an estimated $ 20 million lower. And it must be a point here that who knows what precision future technology can develop the reserves.So Shell claims that the write-offs is of no importance as

Lord of the Flies Essay The Power and Theme of the Conch Shell

864 words - 4 pages The novel; “Lord of the Flies” is a highly renowned novel written by William Golding and published in 1954. The novel embodies many themes and events that are mysterious and unanticipated for the reader. During the course of the essay I will explain how the conch shell that is found at the foundation of the first chapter plays a significant role throughout the novel and how diverse themes are brought on from this influential shell. This essay

Taxonomic Classification Of The Cone Shell Snail (Conus Geographus) And The Uses Of Its Venom

3334 words - 14 pages Conus geographusIntro - Slide 1 (Cone shell snail)Ralph Waldo Emerson once stated "The most dangerous thing is illusion". Good morning/afternoon ladies and gentlemen, my name is Tobias and today I will speak to you on the dangerous illusion that is the Geography Cone.Ranging in size from four to six inches the geography cone is hardly a terrifying sight. In fact, the intricate patterns found on its shell are almost trancelike, but beneath this

Blood, Sweat, Tears and Oil: The mistreatment of the Ogoni People by Royal Dutch Shell

5028 words - 20 pages eastern region of the Niger Delta in 1956. With the country still under British rule, Shell teamed up with the British Petroleum Company to open up the Nigerian oil fields and became the Royal Dutch Shell. For nearly a decade the joint venture produced 367,000 barrels of oil per day. After Nigeria gained its independence from the British, Shell ensured that the Nigerian government would have a share in the company. With oil production going on

Methamphetamine         Methamphetamine a drug that creates a high that makes

729 words - 3 pages MethamphetamineMethamphetamine a drug that creates a high that makes the body speddy, alert, and awake is a growing problem in society today. It has an interesting history with medicine, wars, and a common daily use and is now a multi-million dollar black market problem with the war on drugs. It can be made with the simple use of a cold medicine very cheaply, and sold for ten times what its worth. When made, the drugs are made in big batches to

Similar Essays

Why Did Some Men Desert And Refuse To Obey Orders In The Western Front, And Were They Treated Too Harshly? Looks At The Results Of Shell Shock And Punishments In The Trenches

1621 words - 6 pages thought that basting shells create a vacuum and that when air rushes into the vacuum it disturbs the cerebro-spinal fluid, which in turn upsets the workings of the brain. Some doctors said that the only cure for shell shock was complete rest from fighting. Senior officers were likely to be sent home to recuperate, but there was a lot less sympathetic view for ordinary soldiers. Because of this, the men who went back to the trenches responded in

Ken Saro Wiwa Vs. Shell And Gbemre Vs. Shell Cases

654 words - 3 pages corporate benevolence, whereas in essence the strategy was giving the communities in areas? Some of the activities that were included were: a) Water and sanitation, the firm start off community water scheme. b) Health Care, shell construct a hospital for the population and provide health care. c) Education, the firm started a scholarship project (for university and secondary schools) and construct blocks of classroom. d) Agriculture, the firm provide

Shell Chemical Company And Simon Essay

626 words - 3 pages Shell chemical company had found a new database that would keep them in the market by redesigning their supply chain of process manufacturing to better inventory. These database was called Simon (Supplier Inventory Management Order Network) developed by SCC and SSI (Shell Service International) and has been a value added service for customers and suppliers.Simon helps suppliers to better manage inventory statistics for their customers by

Federal Reserve In A Nut Shell

3429 words - 14 pages a directive to the Federal Reserve Bank of New York--the Bank that executes transactions for the System Open Market Account. The directive is cast in terms designed to provide guidance to the Manager in the conduct of day-to-day open market operations. The directive sets forth the Committee's objectives for long-run growth of certain key monetary and credit aggregates. It also sets forth operating guidelines for the degree of ease or restraint