Fill This Form To Receive Instant Help
Homework answers / question archive / Imagine that we have written numerous C tiles (
Imagine that we have written numerous C tiles (.c files) in a directory D and compiled them to object tiles (.0 files). Now, we want to ship directory D to a client who wants to run the source code. However, we cannot release our source code to protect intellectual property. Hence, we will have to move our source files to another directory and keep the object files in the same directory. However, we need to ensure the following when we are moving source files. 1. While moving files to the destination directory, the directory structure should be maintained. For example, consider that we are moving all C files from directory project to a directory project_src_bkup. Let us say that the directory project has C source files in project/C project/subProjl, project/subProjT/subsubPro?, and project/subProjB. The destination directory project_src_bkup should have the corresponding source files in the same directory structure, that is, project/? project/subProjl', project/subProjT/subsubProjT, and project/subPron 2. Some directories may contain more than 3 C files. Moving files from such directories should be done in an interactive manner. Since we don't want to lose a large number of files, all files being moved should be ?rst displayed to the user. It the user confirms by typing 'y' or "r", then the files should be moved; otherwise, the files should be skipped. 3. If the destination directory does not exist, then it should be created. If the destination directory exists, then it should be removed and then recreated. Write a script prog1.sh to automate the process described above. Your script should take 2 inputs from the command line —— /path/to/srcDir and lpath/to/destDir. Any temporary files created during script execution should be deleted after the script ?nishes execution. If no arguments are provided to the script then exit with status 0 and display the message 'src and dest missing'. If more than 2 arguments are provided to the script, then exit with status 0 and display the message 'Exactly 2 arguments required'. If a valid src directory is not provided as argument then exit with status 0 and display the message 'src not found'.