Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Sat 20 Dec 2014, 02:55
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
Invoking yafc without opening a prompt?
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [10 Posts]  
Author Message
Rattlehead


Joined: 11 Sep 2008
Posts: 228
Location: Madrid, Spain

PostPosted: Sun 23 Jan 2011, 10:39    Post subject:  Invoking yafc without opening a prompt?
Subject description: Anybody mastered its syntax?
 

Hello, I have installed the console ftp client yafc (Yet Another Ftp Client), and I'm very happy with its bash-like syntax to move things around folders via FTP.
Now I'd like to automatize my operations a bit more with a script to get or put certain files, but I find the following problem: in the first line of my script, I have to open the ftp with this command

Code:
yafc ftp://user:password@host/some/folder


when I do this, yafc opens its own prompt, so it doesn't reach my next yafc commands.

Anybody knows how to send several orders in succession to yafc without having the prompt showing up? My hope is it is an elemental redirection problem. Thank you
Back to top
View user's profile Send private message 
trapster


Joined: 28 Nov 2005
Posts: 2030
Location: Maine, USA

PostPosted: Sun 23 Jan 2011, 11:13    Post subject:  

Code:
#!/bin/bash
yafc  <<**
open ftp://username:password@somewhere/
ls
rm -f dir/somefile.txt
rm -f dir/anotherfile.txt
put -f -r /home/user/*
close
**

_________________
trapster
Maine, USA

Asus eeepc 1005HA PU1X-BK
Frugal install: Puppeee4.31 + 1.0, Puppy4.10 + Lupu52
Currently using Slacko AND lupu52 w/ fluxbox
Back to top
View user's profile Send private message Visit poster's website 
amigo

Joined: 02 Apr 2007
Posts: 2291

PostPosted: Sun 23 Jan 2011, 14:27    Post subject:  

That sort of syntax is pretty common for scripting commands for ftp clients -and is also used for scripting fdisk commands. I'd use something besides '**', though, like 'EOF' to avoid any possible probelems and for readability. MHO.
Back to top
View user's profile Send private message 
Shel

Joined: 11 Apr 2009
Posts: 103
Location: Seattle, WA, USA, or Southern France

PostPosted: Sun 23 Jan 2011, 14:37    Post subject:  

While Trapster's "here document" (q.v.) will work, you might want a more robust solution, particularly one that can handle errors and other exceptions. The classic solution here is the 'expect' scripting language, though I don't know if a Puppy package is available.

-Shel
Back to top
View user's profile Send private message 
Rattlehead


Joined: 11 Sep 2008
Posts: 228
Location: Madrid, Spain

PostPosted: Mon 24 Jan 2011, 06:14    Post subject:  

Thanks people, it's exactly what I was looking for. Very Happy

As for the Expect language, it seems a bit of overkill to me, I just want to do a couple of fixed operations and I'm sure they do not generate errors, so bash is alright. But thank you, I did not know that one (how many computer languages are there? OMG...)
Back to top
View user's profile Send private message 
amigo

Joined: 02 Apr 2007
Posts: 2291

PostPosted: Mon 24 Jan 2011, 11:19    Post subject:  

expect is not really a 'language'. It's a small program which can be used to automate what would ordinarily be interactive programs. There is a similar program called 'yes' which will answer 'yes' to any pauses a program makes when run in conjunction with 'yes'. expect is a more robust tool which can handle other answers bseides 'yes'. It has a more elaborate syntax which *could* be considered a language if you stretch the meaning of the word. Similarly, ImageMagick also has a script-like syntax when used from the command-line.
Back to top
View user's profile Send private message 
Rattlehead


Joined: 11 Sep 2008
Posts: 228
Location: Madrid, Spain

PostPosted: Wed 26 Jan 2011, 09:47    Post subject:  

Thank you for the information. I'll stick to plain bash anyway, because it's what I know best, and writing my tiny scripts makes me feel very 'hi-tech' Razz
Back to top
View user's profile Send private message 
technosaurus


Joined: 18 May 2008
Posts: 4424

PostPosted: Mon 07 Feb 2011, 02:09    Post subject:  

Sounds like a good candidate for a gtkdialog frontend. What is the size?
_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
Rattlehead


Joined: 11 Sep 2008
Posts: 228
Location: Madrid, Spain

PostPosted: Wed 09 Feb 2011, 20:45    Post subject:  

Quote:
What is the size?


Of Yafc, you mean? I've been looking for the pet file and I don't have it anymore, and i cannot find it in the forum either. Confused But it was pretty small, that's for sure...
Back to top
View user's profile Send private message 
technosaurus


Joined: 18 May 2008
Posts: 4424

PostPosted: Thu 10 Feb 2011, 23:16    Post subject:  

Busybox has ftpput ftpget and tftp ... as well as ftpd and tftpd ... should do most needs.
_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [10 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0604s ][ Queries: 12 (0.0042s) ][ GZIP on ]