Find Jobs
Hire Freelancers

creating bash

$10-30 USD

Completed
Posted over 6 years ago

$10-30 USD

Paid on delivery
You are to make changes to the ssh.c source file to add the operators for redirection, '<', '>>', '>', '|', and the semi-colon, ';'. You only have to do this for two commands, for example: $ cd ..;ls -l total 42 drwxr-xr-x 6 someuser somegrp 4096 Oct 4 20:27 Archive drwx------ 3 someuser somegrp 4096 Oct 4 11:31 Downloads -rw-r--r-- 1 someuser somegrp 0 Oct 4 20:42 [login to view URL] drwxr-xr-x 5 someuser somegrp 4096 Sep 25 08:30 games drwxr-xr-x 2 someuser somegrp 32768 Oct 4 09:15 logs drwxr-xr-x 8 someuser somegrp 4096 Oct 2 17:13 src $ ls ; cd .. ; ls sh: too many commands to process $ Notice in the above examples the use of spaces. Around the operators, spaces don't matter, that is, you can have them there or not. Here are some more examples that you need to consider in writing a solution to this problem. $ cat [login to view URL] > [login to view URL] $ cat < [login to view URL] $ cat [login to view URL] | grep George George Scott Buddy George $ Assume redirection always follows the command as done above. This will make your processing a little easier, however, you must know that processing each command-line must be done in an order. Overall, the order for the shell is to: Break up the line into one or two commands: process the ';' and '|' Now you will need to keep track of the I/O requirements if you find '|'. The output of the first command goes to a pipe and the input of the second command comes from the pipe. Process redirection for each command: process the '<', '>>', and '>' You need to understand that the shell does not check for errors, such as, the second command receiving input from a pipe and also a redirection of input for the second command. Something like this: $ cat [login to view URL] | grep xyz <[login to view URL] In this case, the last processed I/O (the redirection) takes precedent and the pipe if forgotten! Even this does the last redirection without errors: $ grep xyz <[login to view URL] <[login to view URL] Test some of these variations on bash to verify the results. Make up some of your own to exhaust the combinations. It is surprising how many such errors are passed by in bash and other shells but this is the behavior of these programs. They do very little to determine if the command-line makes sense and just tries to perform the command as if nothing is wrong. HTML is processed in a very similar way. Errors are not recognized. Browsers will just try something without outputting any errors. The shell will print an error if it cannot understand some command, otherwise it just continues processing. Once each of the above steps is processed, then you can process the command normally as we developed in class. To summarize, the command line specification will be: Commands are of the form: "command [options] [arguments]" (Remember here spaces are significant.) Redirection is allowed at the end of a command in the forms: "< file" or "> file" or ">> file" (Spacing using redirection does not matter! Spaces can be absent or present.) Two commands can be placed on a single command line using ';' and '|'. The two forms would look like: "command-with-redirection ; command-with-redirection" or "command-with-redirection | command-with-redirection" (Again, spaces can be absent or present and it is interpreted the same.) This means that redirection binds tighter to the commands than either ';' or '|'. Remember to follow the examples above as a specification of your shell's behavior. I may not have listed all the problems that might occur for processing commands this way, although I have stated the general solution and behavior. So if you need more details, you should explore bash and discover the behavior using bash. I've included some source code for ssh4.c and examples for creating processes with a pipe. Redirection is very similar except instead of creating a pipe, you should just open the files for I/O as specified in the redirection.
Project ID: 15815564

About the project

3 proposals
Remote project
Active 6 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs
Awarded to:
User Avatar
I can do it for you Relevant Skills and Experience Linux Stay tuned, I'm still working on this proposal.
$25 USD in 1 day
5.0 (5 reviews)
3.2
3.2
3 freelancers are bidding on average $25 USD for this job
User Avatar
My expertise and core knowledge in this field makes me the best suitable candidate for this job. I can assure you that you would love to hire me again once you are done with this job. Relevant Skills and Experience Linux, UNIX Proposed Milestones $25 USD - Payment after all work done
$25 USD in 1 day
5.0 (14 reviews)
3.7
3.7

About the client

Flag of UNITED STATES
United States
0.0
0
Member since Dec 6, 2017

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759) & Freelancer Online India Private Limited (CIN U93000HR2011FTC043854)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.