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 - /var
2 - /etc :
1
: bad variable name: read: word
first_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 - /var"
echo "2 - /etc : "
read word
case $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
bash filename?sh filename.sh