The script executes on a Mac machine and creates the output file, although on an Ubuntu machine it generates error message. Bash shell is used on both instances.:1 - /var2 - /etc : 1: bad variable name: read: wordfirst_part(1).sh: 6: first_part(1).sh: Syntax error: newline unexpected (expecting ))-echo To scan through the directories /var and /etc type 1 or 2: echo 1 - /varecho 2 - /etc : read wordcase $word in         1)                find /var -type d -follow -ls | awk '{print $3, $5, $6, $11}' > var.txt                echo Your file containing /var information has been created.                ;;         2)                find /etc -type d -follow -ls | awk '{print $3, $5, $6, $11}' > etc.txt                echo Your file containing /etc information has been created.                ;;         *)                echo Please insert a valid input                continue                ;;esac
Script working on Mac but not Ubuntu
bash;shell script
If you execute the file by using sh filename.sh, then one problem is that, on your Ubuntu system, this might not execute bash but some other shell. On my Ubuntu 12.04 system sh is /bin/sh and is soft linked to /bin/dash (with a d; see Dash as /bin/sh).You should use bash filename.sh, or use a shebang line and make the file executable (chmod +x filename.sh).#!/bin/bashecho To scan through the directories /var and /etc type 1 or 2: echo 1 - /var..One thing to check when moving files from Mac to Ubuntu are the newlines of the file (use od -c file_name), if there are '\r' characters in the output, but not \n you have to convert e.g. using:tr '\r' '\n' < file_name > new_file_name.