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 Thu 30 Oct 2014, 13:43
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 Posts_count  
Author Message
Rattlehead


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

PostPosted: Sun 23 Jan 2011, 10:39    Post_subject:  Invoking yafc without opening a prompt?
Sub_title: 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: 2012
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_website 
amigo

Joined: 02 Apr 2007
Posts: 2263

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: 215
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: 2263

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: 215
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: 4353

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: 215
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: 4353

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:   Sort by:   
Page 1 of 1 Posts_count  
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » Off-Topic Area » Programming
Jump to:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0581s ][ Queries: 11 (0.0044s) ][ GZIP on ]