Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Project Create a shell script which creates a list of all broken symbolic links

ID: 3914712 • Letter: P

Question

Project Create a shell script which creates a list of all broken symbolic links on the system and print it. Create a script which compresses all files individually in a given directory and all its subdirectories using gzip. This is handy for saving space on a system where files containing documentation for programs installed on the system can be compressed. Try compressing all html, txt and pdf files in /usr/share/doc and its subdirectories using this script. Usually on working on projects Makefiles contain debugging options in the variable CFLAGS to aid in debugging during development. Write a script for aiding you in removing these debugging options from the CFLAGS variable automatically for you after development is complete and adding optimizing options in their place. 2. 3. 4. Write a shell script that creates a list of all mp3 files on a file system containing complete path names of these. This file can be used as a play-list for media players on Linux. Enhance the script to invoke your favorite media player (mplayer, xmms etc.) with this play-list. There is a wget program to automatically download complete websites for viewing the websites offline later. Create a shell script which uses wget to download a given website automatically for you in a given directory for later viewing. After the website has been downloaded have the script tar and gzip the website in a separate file. Write a script that adds a directory to the system path variable. Write a script that copies a list of files from one directory to the other. During copying the script should make the following changes to the files: capitalize the first letter of the filename and lowercase all other letters. Change the owner of the files to a given owner and cha 5. 6. 7. nge the permissions to a given set of permissions. 8. Write a script to convert DOS CR/LF files to UNIX files in which lines end in LF

Explanation / Answer

1. To find broken symbolic links in a system, you can use:


<!-- language: bash -->

find /path/to/search -type l -exec test ! -e {} ; -print

it will also result the cyclic links in the system as well.

2. To create a script which compress all files individually in a given directory and all its subdirectories using gzip

-use
ar -zcvf compressFileName.tar.gz folderToCompress

4.

To find all your .mp3 files, use

# find / -iname "*.mp3" -print

To find and move all your .mp3 files in one single pass, use

# find / -iname "*.mp3" -exec mv {} /mnt/mp3 ;