Find Jobs
Hire Freelancers

Bash Script

$30-125 USD

In Progress
Posted almost 16 years ago

$30-125 USD

Paid on delivery
Write a command called directory which will present a visual representation of the user’s directory structure, starting from their $HOME directory and passing through each directory in the hierarchy.? The screen should be cleared before presenting the output, and the user should be offered the command prompt after the display has been given. The hierarchical level of each directory needs to be represented by the length of an indent string so that the user can immediately see which directories are under which parent directories.? You should also add a number at the end of each directory line.? ? Write additional features into the standard directory program so that after the directory structure has been displayed to the user, the user may jump to a given directory by specifying a given argument. The behaviour of directory should be amended so as to fulfill the following: i) when directory is executed with more than one argument, a non-numeric argument, or a number greater than the highest number in the directory structure output display, correct usage is displayed. ii) when directory is executed with a single argument of 0, the directory structure is displayed. iii) when directory is executed with a number within the range 1-<max-number-from-dir-structure-display> (ie in the example below 1-14), the user is automatically taken to the corresponding directory, the name of which is displayed. Follows is an example of the result of directory 0 being entered at the command prompt. ## Deliverables Using these tools create a bash script to do the following below. ? echo ? if / test ? loops ? clear ? arrays ? functions (esp concept of recursion) ? how the path works ? variable assignment ? let ? directory structures ? ls The directory command Write a command called directory which will present a visual representation of the user’s directory structure, starting from their $HOME directory and passing through each directory in the hierarchy.? The screen should be cleared before presenting the output, and the user should be offered the command prompt after the display has been given. The hierarchical level of each directory needs to be represented by the length of an indent string so that the user can immediately see which directories are under which parent directories.? You should also add a number at the end of each directory line.? See the example below for the presentation of the output: -(0) /home/<user-name>-(1) ..........a-(2) ....................Flat-(3) ..............................Database-(4) ..............................unix-(5) ........................................dir1-(6) ....................taxes-(7) ....................Database-(8) ..............................course-(9) ..............................force-(10) ........................................exercises-(11) ..................................................Compose10-(12) ..................................................Compose11-(13) ..................................................Compose12-(14) The example above shows that directly under the home directory, there is a single directory ‘a’ which contains ‘Flat’, ‘taxes’ and ‘Database’.? Under ‘Flat’ there is ‘Database’ and ‘unix’. Note the ‘empty’ directory above the output with the number 0.? You should place the first element of your list of directories as element 0, and the home directory as element 1. All subsequent directories need to be numbered sequentially, irrespective of their hierarchical placement, as shown above. Configuration Allow the developer to specify which character should be used as an indent marker (in the example above, this is a ‘.’ Character), and how many characters should be used for each indent level; this should be done in a convenient place in the script, so that it can be easily changed. Write additional features into the standard directory program so that after the directory structure has been displayed to the user, the user may jump to a given directory by specifying a given argument. The behaviour of directory should be amended so as to fulfill the following: i) when directory is executed with more than one argument, a non-numeric argument, or a number greater than the highest number in the directory structure output display, correct usage is displayed. ii) when directory is executed with a single argument of 0, the directory structure is displayed. iii) when directory is executed with a number within the range 1-<max-number-from-dir-structure-display> (ie in the example below 1-14), the user is automatically taken to the corresponding directory, the name of which is displayed. Follows is an example of the result of directory 0 being entered at the command prompt. -(0) /home/<user-name>-(1) ..........a-(2) ....................Flat-(3) ..............................Database-(4) ..............................unix-(5) ........................................dir1-(6) ....................taxes-(7)
Project ID: 3924722

About the project

5 proposals
Remote project
Active 16 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
See private message.
$85 USD in 2 days
5.0 (160 reviews)
6.0
6.0
5 freelancers are bidding on average $85 USD for this job
User Avatar
See private message.
$85 USD in 2 days
4.9 (210 reviews)
6.2
6.2
User Avatar
See private message.
$106.25 USD in 2 days
5.0 (75 reviews)
4.6
4.6
User Avatar
See private message.
$106.25 USD in 2 days
4.8 (20 reviews)
4.4
4.4
User Avatar
See private message.
$42.50 USD in 2 days
0.0 (0 reviews)
0.0
0.0

About the client

Flag of UNITED STATES
United States
5.0
2
Member since May 10, 2008

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)
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.