Re: bash script goes too fast

From: Andreas Tretow (andreas.tretow-ng_at_gmx.de)
Date: 02/14/04


Date: Sat, 14 Feb 2004 18:47:44 +0100

On Sat, 14 Feb 2004 17:44:45 +0000, charly wrote:

> Greetins,
>
> Im trying to achieve the following thing :
>
> tar cz /somedir -f somedir.tgz
> then put via ftp somedir.tgz to a remote server.
>
> I can do all this with no pb on command line.
>
> When i make it via script, it tries to ftp the file while it is still
> under construction -> file not found.

Don't be shy ;-), show us your script.

> I could do it like this :
> tar cz /somedir -f somedir.tgz &
> ftp

No you couldn't. A single ampersand, the control operator '&', means that
the command preceding it will be executed in a subshell in the background.
It will then go on and execute the next command regardless of the first
command's status. You want to use the control operator '&&', i.e. AND,
which will execute the second command only after the first command is
executed with an exit status of zero.

For more information have a look at 'man bash'.

> but I tar several files in several archives and need to transfer all of
> them then "rm" them.

Also have a look at 'man ncftpput' if you really have to use FTP,
otherwise try 'man ssh' and 'man scp'.
 
> Can someone tell me how can I make bash wait for tar processes to be
> done ?
>
> thank you !

HTH
Andreas



Relevant Pages

  • Re: FTP PUT with Store Unique
    ... years ago but had totally forgotten - I appreciated that the STOU command is ... covers the point I want to make which is that the FTP client commands are ... An SUNIQUE command compatible ...
    (bit.listserv.ibm-main)
  • Re: FTP PUT with Store Unique
    ... The best list for topics related to the Communications Server IP ... command or vice versa. ... Instructs the FTP client not to include a name with the STOU ... -- If NONAME is in effect, no name string specifying a foreign_file value follows ...
    (bit.listserv.ibm-main)
  • Re: FTP PUT with Store Unique
    ... a date/time stamp into the name before the FTP step. ... I foolishly assumed when I saw the SUnique parameter that - of course! ... command or vice versa. ... -- If NAME is in effect, the name string specifying a foreign_file value ...
    (bit.listserv.ibm-main)
  • Re: variable question
    ... Something I failed to mention was that I may be trying to send up to 100 files in a run, so i dont want to be exiting ftp and restarting it every file... ... on the ftp internal commands to copy and purge cos that works, and I coulnt find any other way to execute local commands inside ftp. ... command and then set CI variables so I know what command failed. ... !setvar remotefile ' ' ...
    (comp.sys.hp.mpe)
  • Re: Problem about Window Xp SP2 firewall and the buildin FTP command
    ... I copy your example ftp command file to a.txt saved in C:\dell folder. ... I cannot turn off Windows Firewall, since it is controlled by Domain ...
    (microsoft.public.windowsxp.general)