The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 04-21-2009
Fred Goldman Fred Goldman is offline
Registered User
  
 

Join Date: Nov 2007
Posts: 25
Syntax error, puzzling

I am just learning over here unix scripting and the OS in general.

I wrote this script (with some great help from you guys here) when I test at my desktop with cygwin it works fine, but when I take it to work and try it on the Solaris 2 system there I get an error on line 4 syntax error "fileArray". So I tried putting spaces in befor and after the = sign and I got a syntax error on line 4 character "(". This is all very puzzling to me. I would very grateful if someone could help.

I don't know if this is important, but my shell tool says on top it says it is tcsh.

Here is the full script:


Code:
#!/usr/bin/sh
echo "[CTO][GSR]/ /  /|ql|[CTE]
[DOWN]" > C:/Test/File
fileArray=($(find . -maxdepth 1 -name 'P*' -type f))
tLen=${#fileArray[@]}
echo "$tLen"
for (( i=1; i<${tLen}; i++ ));
do 
echo "[CTO][GSR]/ /  /|ql|[CTE]
[DOWN]" >> C:/Test/File
done
for file in /usr/tmp
do
    rm "$file"
done