Govur University Logo
--> --> --> -->
...

Write a shell script that performs file and directory manipulation tasks.



``` bash`#!/bin/bash # File and Directory Manipulation Script # 1. Create a directory mkdir mydir # 2. Navigate to the created directory cd mydir # 3. Create files touch file1.txt touch file2.txt # 4. List the files in the directory ls # 5. Rename a file mv file1.txt newfile.txt # 6. Copy a file cp newfile.txt copiedfile.txt # 7. Move a file to a different directory mkdir newdir mv copiedfile.txt newdir/ # 8. Change directory permissions chmod 755 newdir # 9. Remove a file rm newdir/copiedfile.txt # 10. Remove a directory rmdir newdir # 11. Retrieve the current working directory current_dir=$(pwd) echo "Current directory: $current\_dir" # 12. Check if a file exists if [ -f newfile.txt ]; then echo "File exists" else echo "File does not ....

Log in to view the answer



Redundant Elements