![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| I need help with arrays in C Shell | domain | Shell Programming and Scripting | 5 | 11-19-2008 08:17 AM |
| Korn Shell Script to find out error in logfile | jithu | Shell Programming and Scripting | 2 | 04-24-2008 02:12 PM |
| how to use arrays in c shell | hgphsf | Shell Programming and Scripting | 6 | 12-14-2007 02:03 PM |
| Error Handling in Korn Shell scripts | bhgopi | UNIX for Advanced & Expert Users | 4 | 09-06-2005 06:44 PM |
| korn shell "loops & arrays" | muzica | Shell Programming and Scripting | 7 | 09-23-2004 03:02 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Hi All
I have a FTP script which FTPs few files into an user folder. I intend to keep track of the folder size before FTP and after FTP and print that once the FTP script is run (a kind of comparison, "Before FTP, "After FTP"). I decided to use kron shells to accomplish this. Code:
#! /bin/ksh
analyse_folders_pre() {
# List of directories to check.
dirNames[0]='bin'
dirPath[0]='/home/user1/bin'
dirNoFilesPre[0]=$(ls ${dirPath[0]} | wc -l | awk '{print $1}')
idx=0
while [ $idx -ne 1 ]
do
tempSize=0
dirFileSizePre[$idx]=0
dirSize=0
for i in $(ls ${dirPath[0]})
do
tempSize=$( ls -l $i | awk '{print $5}')
((dirSize=dirSize+tempSize))
done
dirFileSizePre[$idx]=$dirSize
((idx = idx+1))
done
} ### End of analyse_pack_rel_pre
### Main Script Starts here ###
# List of directories to check.
dirNames[0]='bin'
export dirNames
dirPath[0]=''
export dirPath
dirNoFilesPre[0]=0
export dirNoFilesPre
dirNoFilesPost[0]=0
export dirNoFilesPost
analyse_folders_pre
### Script to FTP
ftp_files
analyse_folders_post
i=0
while [ $i -ne 1 ]
do
echo ${dirNoFilesPre[$i]}
echo ${dirFileSizePre[$i]}
echo ${dirNoFilesPost[$i]}
echo ${dirFileSizePost[$i]}
((i=i+1))
done
syntax error at line 8: `dirNoFilesPre[0]=$' unexpected What might be wrong? Is there any better way to do it? |
|
||||
|
Same error
Still getting the same error. . .
|
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|