Hi Gurus,
I have been having trouble finding where I'm wrong.
Problem:
I'm trying list all files exceeding 1.5G everything works fine if I move to bash, but I want to get this to work on bourne shell.
/twork > ls -al
total 12908196
drwxr-xr-x 2 root other 512 May 29 16:20 .
drwxr-xr-x 3 root other 512 May 29 12:43 ..
-rw-r--r-- 1 root other 3302859316 May 29 11:31 a
-rw-r--r-- 1 root other 1992294400 May 29 13:52 b
-rw-r--r-- 1 root other 1310564916 May 29 13:55 c
/work > ls -al|grep -v "^total"|grep -v "d"|awk '{print $5, $9}'|while read si fi
> do
> if [ $si -gt 1500000000 ]
> then
> echo $si size $fi file
> fi
> done
1992294400 size b file
< I expect file "a" to appear in the output ???? >
This is very simple straight forward but it doesn't trap the file "a". It traps only file "b".
Workaround:
When I change my shell to bash it works fine but I would like to stick to bourne shell.
/twork > bash
/twork> ls -al|grep -v "^total"|grep -v "d"|awk '{print $5, $9}'|while read si fi
> do
> if [ $si -gt 1500000000 ]
> then
> echo $si size $fi file
> fi
> done
3302859316 size b file
1992294400 size a file
/twork >
I have tried the following but none of the changes trappped file a.
if [ $si -gt 1500000000 ]
if [ "${si} -gt 1500000000 ]
I appreciate any assistance.
Thanks
I have been having trouble finding where I'm wrong.
Problem:
I'm trying list all files exceeding 1.5G everything works fine if I move to bash, but I want to get this to work on bourne shell.
/twork > ls -al
total 12908196
drwxr-xr-x 2 root other 512 May 29 16:20 .
drwxr-xr-x 3 root other 512 May 29 12:43 ..
-rw-r--r-- 1 root other 3302859316 May 29 11:31 a
-rw-r--r-- 1 root other 1992294400 May 29 13:52 b
-rw-r--r-- 1 root other 1310564916 May 29 13:55 c
/work > ls -al|grep -v "^total"|grep -v "d"|awk '{print $5, $9}'|while read si fi
> do
> if [ $si -gt 1500000000 ]
> then
> echo $si size $fi file
> fi
> done
1992294400 size b file
< I expect file "a" to appear in the output ???? >
This is very simple straight forward but it doesn't trap the file "a". It traps only file "b".
Workaround:
When I change my shell to bash it works fine but I would like to stick to bourne shell.
/twork > bash
/twork> ls -al|grep -v "^total"|grep -v "d"|awk '{print $5, $9}'|while read si fi
> do
> if [ $si -gt 1500000000 ]
> then
> echo $si size $fi file
> fi
> done
3302859316 size b file
1992294400 size a file
/twork >
I have tried the following but none of the changes trappped file a.
if [ $si -gt 1500000000 ]
if [ "${si} -gt 1500000000 ]
I appreciate any assistance.
Thanks