Avatar of ForLoop5
ForLoop5
Flag for United States of America asked on

Please help me with this script

I got some help with the script below.    But when I run the script I get an error that says "line 2: syntax error: unexpected end of file" Anyone know what is wrong?  I am running mac os 10.7.  I am saving the script as a .sh file and applying the chmod u+x permissions before running the script.

for USER in {ls -1 /Volumes/Data/Students}
do
echo rm -rf /Volumes/Data/Students/$USER/Library/Application\ Support/Adobe/Acrobat
echo rm -rf /Volumes/Data/Students/$USER/Library/Application\ Support/Adobe/Flash\ CS5
echo mkdir -p /Volumes/Data/Students/$USER/Library/Application\ Support/Adobe/Acrobat
echo ln -s /Users/Shared /Volumes/Data/Students/$USER/Library/Application\ Support/Adobe/Acrobat/9.0_x86
echo ln -s /Users/Shared /Volumes/Data/Students/$USER/Library/Application\ Support/Adobe/Flash\ CS5
echo cp -a /var/root/resources/com.adobe.acrobat.90.sh.plist /Volumes/Data/Students/$USER/Library/Preferences/
echo chmod 777 /Volumes/Data/Students/$USER/Library/Preferences/com.adobe.acrobat.90.sh.plist
done
Apple OSSwift Programming

Avatar of undefined
Last Comment
serialband

8/22/2022 - Mon
Arun Kumar V

Try without space

echo rm -rf /Volumes/Data/Students/$USER/Library/Application\ Support/Adobe/Flash\CS5
echo ln -s /Users/Shared /Volumes/Data/Students/$USER/Library/Application\ Support/Adobe/Flash\CS5
serialband

change that first line to
for USER in `ls -1 /Volumes/Data/Students`

Open in new window


Make sure you are using the backquote (`) not the forward single quote (')
tyum

The file extension and permissions have nothing to do with that error.  It tells you where to look....Line 2.  If that is your entire script, line 2 would be the "do" statement.  It's been a while since I did any scripting but isn't do a conditional statement?  Do...Until, or Do...While???  Also I was taught that the very first line should declaring the location and type of shell you are using for example:
          #!/bin/bash
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
ASKER CERTIFIED SOLUTION
serialband

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question