Avatar of ForLoop5
ForLoop5Flag 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}
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
Apple OSSwift Programming

Avatar of undefined
Last Comment
Avatar of Arun Kumar V
Arun Kumar V
Flag of India image

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
Avatar of serialband
Flag of Ukraine image

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 (')
Avatar of 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:
Avatar of serialband
Flag of Ukraine image

Blurred text
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Apple OS
Apple OS

Apple's early computers ran on a variety of operating systems, including a Pascal version and one based on CP/M, before releasing its ProDOS with the advent of its 16-bit computer. With the release of the Lisa, which had its own OS, Apple and computing entered the graphical age; it was followed by the Macintosh, which offered a series of "System" operating systems. Other Mac operating systems included PowerPC until Apple acquired NeXT and folded it into the Mac OS. Current operating systems for Apple devices are Mac OS-X and iOS.

Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews


IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo