Find Jobs
Hire Freelancers

Bash Script

$30-125 USD

进行中
已发布将近 16 年前

$30-125 USD

货到付款
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)
项目 ID: 3924722

关于此项目

5提案
远程项目
活跃16 年前

想赚点钱吗?

在Freelancer上竞价的好处

设定您的预算和时间范围
为您的工作获得报酬
简要概述您的提案
免费注册和竞标工作
颁发给:
用户头像
See private message.
$85 USD 在2天之内
5.0 (160条评论)
6.0
6.0
5威客以平均价$85 USD来参与此工作竞价
用户头像
See private message.
$85 USD 在2天之内
4.9 (210条评论)
6.2
6.2
用户头像
See private message.
$106.25 USD 在2天之内
5.0 (75条评论)
4.6
4.6
用户头像
See private message.
$106.25 USD 在2天之内
4.8 (20条评论)
4.4
4.4
用户头像
See private message.
$42.50 USD 在2天之内
0.0 (0条评论)
0.0
0.0

关于客户

UNITED STATES的国旗
United States
5.0
2
会员自5月 10, 2008起

客户认证

谢谢!我们已通过电子邮件向您发送了索取免费积分的链接。
发送电子邮件时出现问题。请再试一次。
已注册用户 发布工作总数
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
加载预览
授予地理位置权限。
您的登录会话已过期而且您已经登出,请再次登录。