Great question — answering as the UphillTech team:
Your script should look like this: #!/bin/bash echo -e "enter the filename: \c" something_to_add=/path/to/something_to_add/file read -r file_content if [ -f "$file_content" ] then if [ -w "$file_content" ] then echo "Please Press Ctrl+c to exit" cat "$something_to_add" >> "$file_content" else echo "You dont have permission to write" fi else echo "You have file name $file_content" fi Errors noted: Shebang: wrong ( #!/bash/bin/bash ) right ( #!/bin/bash ), better ( #!/usr/bin/env bash ). Inner if statement has a wrong else segment. Added double quotes where necessary. Rather than echo cat >> do cat >> Use this online service to check your script: https://www.shellcheck.net/
Full answer by George Udosen: https://askubuntu.stackexchange.com/a/1105800 (CC BY-SA 4.0).
Need it done for your business? UphillTech.