Generating a generic incremental code

Hi Gurus,

I have several Solaris systems (say system a, system b,system c) which will connect to a windows system (system Z) using SFTP session.

I have a 'txt' file on System Z , which has a simple numeric value on it(say 1) , If I have to increment this number with 1 (1+1 =2) irrespective of the source system . how do i do this.

Ex: I connect from system a to system Z , read the txt file get the number 1 , increment this number to 2 (1+1=2) . When I connect from system b or system c the number in txt file to be read should be 2, this number is once again incremented to 3 (2+1=3).
The Challenge: I'm unable to increment the file using the sftp session.

Please shed some light....

Thanks
Ram.

i) what do you *really* want to do?
ii) depending on i) : beware of race conditions! They can hurt you! (ask google)
iii) break up into simple steps in bash code to be run on e.g. a:

scp Z:/dir/number.txt .
echo $[`cat number.txt` + 1] > number.txt
scp number.txt Z:/dir/

(depending on i) you should maybe use something able to look a file, e.g. a database or a tool on z called via ssh)

these are the only commands i can use on my sftp on system Z

sftp > help
Available commands:
cd path Change remote directory to 'path'
lcd path Change local directory to 'path'
chgrp grp path Change group of file 'path' to 'grp'
chmod mode path Change permissions of file 'path' to 'mode'
chown own path Change owner of file 'path' to 'own'
help Display this help text
get remote-path [local-path] Download file
lls [ls-options [path]] Display local directory listing
lmkdir path Create local directory
lpwd Print local working directory
ls [path] Display remote directory listing
lumask umask Set local umask to 'umask'
mkdir path Create remote directory
put local-path [remote-path] Upload file
pwd Display remote working directory
exit Quit sftp
quit Quit sftp
rename oldpath newpath Rename remote file
rmdir path Remove remote directory
rm path Delete remote file
!command Execute 'command' in local shell
! Escape to local shell
? Synonym for help

Now,
How to read the contents of the number.txt on system Z ???

I tried using the !cat number.txt, but it says file not found...

Try to actually understand what I've written, so you
i) won't have such problems using answers on this board
ii) will be able to help yourself in the future

You should run those commands on e.g. a, not z.