Here, I use the .popt file defined a alias option for rsync and then invoke it with the alias -Z option. I want to know is it possible to using the alias function without using the .popt alias file, say, just by using the in-line/in-place redefinitions in-line/in-place within the rsync commands?
> Here, I use the .popt file defined a alias option for rsync and then > invoke it with the alias -Z option. I want to know is it possible to > using the alias function without using the .popt alias file, say, just by > using the in-line/in-place redefinitions in-line/in-place within the rsync > commands?
I can't follow what you want. An example might help.
On Sat, 27 Oct 2012 20:44:55 +0100, Ben Bacarisse wrote:
> I can't follow what you want. An example might help.
I mean without setting these options using the popt file, while using it in, say, the ssh shell sript. With this way, it can let me obtain the less script files for one job.
Hongyi Zhao <hongyi.z...@gmail.com> writes:
> On Sat, 27 Oct 2012 20:44:55 +0100, Ben Bacarisse wrote:
>> I can't follow what you want. An example might help.
> I mean without setting these options using the popt file, while using it > in, say, the ssh shell sript. With this way, it can let me obtain the > less script files for one job.
That's not an example -- I still don't follow.
Part of the problem is what you seem to be asking -- how to avoid using
the .popt file -- seems to be too simple to be the actual problem. If
that's all you want to do, just add the arguments that -Z aliases
directly.
On Sun, 28 Oct 2012 21:26:07 +0000, Ben Bacarisse wrote:
> Part of the problem is what you seem to be asking -- how to avoid using
> the .popt file -- seems to be too simple to be the actual problem. If
> that's all you want to do, just add the arguments that -Z aliases
> directly.
Let me give more detailed of my topic:
In my case, I first use the /home/werner/.popt file to define the alias -
Z as follows:
$ cat /home/werner/.popt
rsync alias -Z --no-p --no-g --chmod=ugo=rwX
Now, suppose I want to do some more complicated job including the above codes in it, I think it's a more easier way first define the alias_varialbe in the script then invoke it by using rsync command in the same script. I just want to know how to do the above things like this way.
BTW, as you have pointed that, we can simply invoke the rsync like for my purpose:
But for a more complicated case, say, I want to do server different rsync jobs with different alias options in one script, according to the described method here, I must define all of the alias options in /home/
werner/.popt, in this way, I must remember all of the these definitions in mind when I want to invoke them. While if I can define these alias options in-place of the shell script which use all of these alias options, I think it will be more convenient to use.
Hongyi Zhao <hongyi.z...@gmail.com> writes:
> On Sun, 28 Oct 2012 21:26:07 +0000, Ben Bacarisse wrote:
>> Part of the problem is what you seem to be asking -- how to avoid using
>> the .popt file -- seems to be too simple to be the actual problem. If
>> that's all you want to do, just add the arguments that -Z aliases
>> directly.
> Let me give more detailed of my topic:
> In my case, I first use the /home/werner/.popt file to define the alias -
> Z as follows:
> Now, suppose I want to do some more complicated job including the above > codes in it, I think it's a more easier way first define the > alias_varialbe in the script then invoke it by using rsync command in the > same script. I just want to know how to do the above things like this > way.
> BTW, as you have pointed that, we can simply invoke the rsync like for my > purpose:
> But for a more complicated case, say, I want to do server different rsync > jobs with different alias options in one script, according to the > described method here, I must define all of the alias options in /home/
> werner/.popt, in this way, I must remember all of the these definitions > in mind when I want to invoke them. While if I can define these alias > options in-place of the shell script which use all of these alias > options, I think it will be more convenient to use.
The trouble is still that I can't see the problem. You've explained it
in such general terms that is sounds trivial -- just write the various
rsync commands and select one using an argument to the script.
Please give me an example. Show me what you do now using .popt and
explain how that should be made simpler.
On Mon, 29 Oct 2012 02:43:54 +0000, Ben Bacarisse wrote:
> The trouble is still that I can't see the problem. You've explained it
> in such general terms that is sounds trivial -- just write the various
> rsync commands and select one using an argument to the script.
> Please give me an example. Show me what you do now using .popt and
> explain how that should be made simpler.
As far as the current things I've done, such complex case is not the case. But I think I will meet them in some time ;-)
Say, for in a shell script, I think the following method will be more readable:
Hongyi Zhao <hongyi.z...@gmail.com> wrote:
> On Sun, 28 Oct 2012 21:26:07 +0000, Ben Bacarisse wrote:
>> Part of the problem is what you seem to be asking -- how to avoid using
>> the .popt file -- seems to be too simple to be the actual problem. If
>> that's all you want to do, just add the arguments that -Z aliases
>> directly.
> Let me give more detailed of my topic:
> In my case, I first use the /home/werner/.popt file to define the alias -
> Z as follows:
> Now, suppose I want to do some more complicated job including the above > codes in it, I think it's a more easier way first define the > alias_varialbe in the script then invoke it by using rsync command in the > same script. I just want to know how to do the above things like this > way.
Short answer, "No."
Option aliases are implemented by libpopt, to define an alias it is
necessary to address libpopt. The only way to do that (for rsync) is to
use popt's default configuration files.
Hongyi Zhao <hongyi.z...@gmail.com> writes:
> On Mon, 29 Oct 2012 02:43:54 +0000, Ben Bacarisse wrote:
>> The trouble is still that I can't see the problem. You've explained it
>> in such general terms that is sounds trivial -- just write the various
>> rsync commands and select one using an argument to the script.
>> Please give me an example. Show me what you do now using .popt and
>> explain how that should be made simpler.
> As far as the current things I've done, such complex case is not the > case. But I think I will meet them in some time ;-)
Ah. That may explain why I can't see the problem -- you don't yet no
that there will be one.
BTW, I would avoid using .popt defined alias options in a script. You
want the script to stand alone and making it depend on another file is
bound to be confusing; I support your objective, I just don't see the
problem.
> Say, for in a shell script, I think the following method will be more > readable:
That's more readable than using options defined in another file, but I
don't think it's more readable than just writing out the options. You
need to take care when options contain characters that need quoting, but
that's not a common situation.
On Mon, 29 Oct 2012 10:20:05 +0000, Dave Gibson wrote:
> Short answer, "No."
> Option aliases are implemented by libpopt, to define an alias it is
> necessary to address libpopt. The only way to do that (for rsync) is to
> use popt's default configuration files.
As you can see in this topic discussed by me and Ben, I don't think the way implemented by rsync is a good idea ;-(
Hongyi Zhao <hongyi.z...@gmail.com> writes:
> On Mon, 29 Oct 2012 10:20:05 +0000, Dave Gibson wrote:
>> Short answer, "No."
>> Option aliases are implemented by libpopt, to define an alias it is
>> necessary to address libpopt. The only way to do that (for rsync) is to
>> use popt's default configuration files.
> As you can see in this topic discussed by me and Ben, I don't think the > way implemented by rsync is a good idea ;-(
What do you mean? I don't see anything wrong at all. That was part of
the trouble I had -- I could not see what problem you were trying to
solve.
Ben Bacarisse <ben.use...@bsb.me.uk> wrote:
> Hongyi Zhao <hongyi.z...@gmail.com> writes:
>> On Mon, 29 Oct 2012 10:20:05 +0000, Dave Gibson wrote:
>>> Short answer, "No."
>>> Option aliases are implemented by libpopt, to define an alias it is
>>> necessary to address libpopt. The only way to do that (for rsync) is to
>>> use popt's default configuration files.
>> As you can see in this topic discussed by me and Ben, I don't think the >> way implemented by rsync is a good idea ;-(
> What do you mean? I don't see anything wrong at all. That was part of
> the trouble I had -- I could not see what problem you were trying to
> solve.
I think he wants to define popt aliases in the shell.
>>> On Mon, 29 Oct 2012 10:20:05 +0000, Dave Gibson wrote:
>>>> Short answer, "No."
>>>> Option aliases are implemented by libpopt, to define an alias it is
>>>> necessary to address libpopt. The only way to do that (for rsync) is to
>>>> use popt's default configuration files.
>>> As you can see in this topic discussed by me and Ben, I don't think the >>> way implemented by rsync is a good idea ;-(
>> What do you mean? I don't see anything wrong at all. That was part of
>> the trouble I had -- I could not see what problem you were trying to
>> solve.
> I think he wants to define popt aliases in the shell.
> Something like
> $ poptalias rsync -Z --arg1 --arg2
> Then entering
> $ rsync -aZ foo bar
> would become
> $ rsync -a --arg1 --arg2 foo bar
You may be right. I asked three times for an example and someone else
provides it! Just another day on Usenet.
> Now, suppose I want to do some more complicated job including the above > codes in it, I think it's a more easier way first define the > alias_varialbe in the script then invoke it by using rsync command in the > same script. I just want to know how to do the above things like this > way.
> BTW, as you have pointed that, we can simply invoke the rsync like for my > purpose:
> But for a more complicated case, say, I want to do server different rsync > jobs with different alias options in one script, according to the > described method here, I must define all of the alias options in /home/
> werner/.popt, in this way, I must remember all of the these definitions > in mind when I want to invoke them. While if I can define these alias > options in-place of the shell script which use all of these alias > options, I think it will be more convenient to use.
Modify rsync to allow a popt initialisation file to be specified in an
environment variable. Use like this:
# to ignore system popt rc files
RSYNC_POPTRC=/dev/null rsync ...
and so on.
The following patch (between #v+ and #v-) contains tab characters. You
may need to use patch's -l (that's a lower-case L) argument if they are
converted to spaces in transit.
As usual, if this breaks you get to keep all the pieces.
On Wed, 31 Oct 2012 09:26:52 +0000, Dave Gibson wrote:
> Modify rsync to allow a popt initialisation file to be specified in an
> environment variable. Use like this:
> # to ignore system popt rc files RSYNC_POPTRC=/dev/null rsync ...
> and so on.
> The following patch (between #v+ and #v-) contains tab characters. You
> may need to use patch's -l (that's a lower-case L) argument if they are
> converted to spaces in transit.
> As usual, if this breaks you get to keep all the pieces.