Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

Typically, in time every Linux system has a number of symbolic links that are no longer tied with any existing file. This may happen due

Typically, in time every Linux system has a number of symbolic links that are no longer tied with any existing file. This may happen due to various reasons, but ultimately this situation is something that system admin has to deal with. Very frequently the administrator decision is to delete such links. Your task is to trite a script which would remove all symbolink links (symlinks) which are linked to no longer existing files / directories. The operation should be performed in the directory specified as the script execution parameter.

Assuming the script name is scr1 and the directory you want to delete the symlinks is Dir, the script should be executed as: ./scr1 dir_name Test your script before you upload it to the scriptcheck system in the following way: 1. In any directory (you may want to create a special directory for the test purpose) create a number of files (contents is not important, these can even be empty files). 2. Create separate symlinks for each of the files. 3. Execute your script giving the directory name as the script argument (note: in this case none symlink should be deleted). 4. Now delete one or two of the files (but not symlinks). 5. Exectute again your script as previously (note: this time only the symlinks that point at the files you deleted should be removed). 6. If the script did remove the proper symlinks, you can upload the script to the scriptcheck system.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions