Jump to content

Unix Shell Script .. Help.!


Recommended Posts

Posted

if test -s ''$filename''

then

echo ''exist''

else

echo ''doesn't exist''

fi

this didn't work over FTP bye1

  • Replies 38
  • Created
  • Last Reply

Top Posters In This Topic

  • chinni005

    15

  • sigsegv

    6

  • ramafdb

    5

  • Keratam

    5

Posted

why do u need a script to connect ftp..

 

ftp <servername>

<username>

<password>

 

enuf ryt??

 

he is using that in script so it will be easy and listing the files in the same script

Posted

weird thing enti ante I have 3 files in the remote location

 

323232.xml

 

chinni005 keretam 32323.pdf

 

chilligaari spiderreddy official.pdf

 

same ilage 3 files unnayi including spaces and all the file names are same format, 

 

when I do "ls 323232.xml" it is giving me correct results

 

but when I do "ls chinni005 keretam 32323.pdf" it is giving me the error "usage: ls remote-directory local-file" 

 

please Help..!!

$filename =~ s/\s/\\ /g;
$ftp->dir($filename);

This is the correct way to escape the whitespaces.

Posted

okay all, using ls "$filename" is giving me the file name now.. how do i check this inside the script 

 

ftp -vpd $HOST << END_SCRIPT
ls "$filename"
if [ $? -eq 0 ]; then
   echo "file exists: "$filename" "
else
echo "file doesn't exists
 fi
END_SCRIPT
 
 
red lines execute kavadam ledhu.. bye1
 
 
 
Posted

sftp user@host
Password

CD to the directory

find . -name "<regex>"

Akkada regex lo filename ivochu
Match ayithe vasthado
Ledhante dobbamantadi
This is as far I know

brahmismoking.gif

Posted

ftp -vpd $HOST : to connect to remote server

 

ls $filename : gives me if the file exists

 

now how i check this condition in if loop

 

if[ls $filename];then

do something

else

do nothing

 

 

please help me with if condition

Posted

ftp -vpd $HOST : to connect to remote server

 

ls $filename : gives me if the file exists

 

now how i check this condition in if loop

 

if[ls $filename];then

do something

else

do nothing

 

 

please help me with if condition

status code chesk cheyyi ..

 

ls $filename 

 

if $? -eq 0  ;then

do something

else

do nothing

Posted

status code chesk cheyyi ..

 

ls $filename 

 

if $? -eq 0  ;then

do something

else

do nothing

 

 

 

ftp -vpd $HOST << END_SCRIPT
ls "$filename"
if [ $? -eq 0 ]; then
   echo "file exists: "$filename" "
else
echo "file doesn't exists
 fi
END_SCRIPT
 
 
red lines execute kavadam ledhu.. invalid command antundhi...   bye1
Posted

 

ftp -vpd $HOST << END_SCRIPT
ls "$filename"
if [ $? -eq 0 ]; then
   echo "file exists: "$filename" "
else
echo "file doesn't exists
 fi
END_SCRIPT
 
 
red lines execute kavadam ledhu.. invalid command antundhi...   bye1

 

bash ??

×
×
  • Create New...