Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Can I doesn't use popt alias file for rsync, while use the alias function in-line/in-place with the rsync command?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  16 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Hongyi Zhao  
View profile  
 More options Oct 27 2012, 12:22 am
Newsgroups: comp.unix.shell
From: Hongyi Zhao <hongyi.z...@gmail.com>
Date: Sat, 27 Oct 2012 04:22:10 +0000 (UTC)
Local: Sat, Oct 27 2012 12:22 am
Subject: Can I doesn't use popt alias file for rsync, while use the alias function in-line/in-place with the rsync command?
Hi all,

See the following usages of rsync:

$ cat /home/werner/.popt
rsync alias -Z --no-p --no-g --chmod=ugo=rwX

$ rsync -avZ --temp-dir=/tmp /media/cdrom/pool/ /home/werner/Desktop/111/

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?

Regards  


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ben Bacarisse  
View profile  
 More options Oct 27 2012, 3:44 pm
Newsgroups: comp.unix.shell
From: Ben Bacarisse <ben.use...@bsb.me.uk>
Date: Sat, 27 Oct 2012 20:44:55 +0100
Local: Sat, Oct 27 2012 3:44 pm
Subject: Re: Can I doesn't use popt alias file for rsync, while use the alias function in-line/in-place with the rsync command?

Hongyi Zhao <hongyi.z...@gmail.com> writes:
> See the following usages of rsync:

> $ cat /home/werner/.popt
> rsync alias -Z --no-p --no-g --chmod=ugo=rwX

> $ rsync -avZ --temp-dir=/tmp /media/cdrom/pool/ /home/werner/Desktop/111/

> 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.

--
Ben.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Hongyi Zhao  
View profile  
 More options Oct 28 2012, 11:31 am
Newsgroups: comp.unix.shell
From: Hongyi Zhao <hongyi.z...@gmail.com>
Date: Sun, 28 Oct 2012 15:31:15 +0000 (UTC)
Local: Sun, Oct 28 2012 11:31 am
Subject: Re: Can I doesn't use popt alias file for rsync, while use the alias function in-line/in-place with the rsync command?

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.

Regards


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ben Bacarisse  
View profile  
 More options Oct 28 2012, 5:26 pm
Newsgroups: comp.unix.shell
From: Ben Bacarisse <ben.use...@bsb.me.uk>
Date: Sun, 28 Oct 2012 21:26:07 +0000
Local: Sun, Oct 28 2012 5:26 pm
Subject: Re: Can I doesn't use popt alias file for rsync, while use the alias function in-line/in-place with the rsync command?

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.

--
Ben.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Hongyi Zhao  
View profile  
 More options Oct 28 2012, 10:13 pm
Newsgroups: comp.unix.shell
From: Hongyi Zhao <hongyi.z...@gmail.com>
Date: Mon, 29 Oct 2012 02:13:09 +0000 (UTC)
Local: Sun, Oct 28 2012 10:13 pm
Subject: Re: Can I doesn't use popt alias file for rsync, while use the alias function in-line/in-place with the rsync command?

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

Then I run rsync with the alias -Z like this:

$ rsync -avZ --temp-dir=/tmp /media/cdrom/pool/ /home/werner/Desktop/111/

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:

rsync -av --no-p --no-g --chmod=ugo=rwX --temp-dir=/tmp /media/cdrom/
pool/ /home/werner/Desktop/111/

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.

Regards


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ben Bacarisse  
View profile  
 More options Oct 28 2012, 10:43 pm
Newsgroups: comp.unix.shell
From: Ben Bacarisse <ben.use...@bsb.me.uk>
Date: Mon, 29 Oct 2012 02:43:54 +0000
Local: Sun, Oct 28 2012 10:43 pm
Subject: Re: Can I doesn't use popt alias file for rsync, while use the alias function in-line/in-place with the rsync command?

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.

--
Ben.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Hongyi Zhao  
View profile  
 More options Oct 29 2012, 12:30 am
Newsgroups: comp.unix.shell
From: Hongyi Zhao <hongyi.z...@gmail.com>
Date: Mon, 29 Oct 2012 04:30:27 +0000 (UTC)
Local: Mon, Oct 29 2012 12:30 am
Subject: Re: Can I doesn't use popt alias file for rsync, while use the alias function in-line/in-place with the rsync command?

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:

---------------
arg1=--no-p --no-g --chmod=ugo=rwX
...
rsync -av $arg1 --temp-dir=/tmp /media/cdrom/pool/ /home/werner/
Desktop/111/
----------------

Regards


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Hongyi Zhao  
View profile  
 More options Oct 29 2012, 12:44 am
Newsgroups: comp.unix.shell
From: Hongyi Zhao <hongyi.z...@gmail.com>
Date: Mon, 29 Oct 2012 04:44:03 +0000 (UTC)
Local: Mon, Oct 29 2012 12:44 am
Subject: Re: Can I doesn't use popt alias file for rsync, while use the alias function in-line/in-place with the rsync command?

On Mon, 29 Oct 2012 04:30:27 +0000, Hongyi Zhao wrote:
> arg1=--no-p --no-g --chmod=ugo=rwX

...

Sorry, should like this:

arg1="--no-p --no-g --chmod=ugo=rwX"

> rsync -av $arg1 --temp-dir=/tmp /media/cdrom/pool/ /home/werner/
> Desktop/111/

Regards

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dave Gibson  
View profile  
 More options Oct 29 2012, 6:22 am
Newsgroups: comp.unix.shell
From: dave.gma+news...@googlemail.com.invalid (Dave Gibson)
Date: Mon, 29 Oct 2012 10:20:05 +0000
Local: Mon, Oct 29 2012 6:20 am
Subject: Re: Can I doesn't use popt alias file for rsync, while use the alias function in-line/in-place with the rsync command?

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.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ben Bacarisse  
View profile  
 More options Oct 29 2012, 6:50 am
Newsgroups: comp.unix.shell
From: Ben Bacarisse <ben.use...@bsb.me.uk>
Date: Mon, 29 Oct 2012 10:50:15 +0000
Local: Mon, Oct 29 2012 6:50 am
Subject: Re: Can I doesn't use popt alias file for rsync, while use the alias function in-line/in-place with the rsync command?

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:

> ---------------
> arg1=--no-p --no-g --chmod=ugo=rwX
> ...
> rsync -av $arg1 --temp-dir=/tmp /media/cdrom/pool/ /home/werner/
> Desktop/111/
> ----------------

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.

--
Ben.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Hongyi Zhao  
View profile  
 More options Oct 30 2012, 4:54 am
Newsgroups: comp.unix.shell
From: Hongyi Zhao <hongyi.z...@gmail.com>
Date: Tue, 30 Oct 2012 08:54:15 +0000 (UTC)
Local: Tues, Oct 30 2012 4:54 am
Subject: Re: Can I doesn't use popt alias file for rsync, while use the alias function in-line/in-place with the rsync command?

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 ;-(

Regards


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ben Bacarisse  
View profile  
 More options Oct 30 2012, 7:57 am
Newsgroups: comp.unix.shell
From: Ben Bacarisse <ben.use...@bsb.me.uk>
Date: Tue, 30 Oct 2012 11:57:15 +0000
Local: Tues, Oct 30 2012 7:57 am
Subject: Re: Can I doesn't use popt alias file for rsync, while use the alias function in-line/in-place with the rsync command?

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.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dave Gibson  
View profile  
 More options Oct 30 2012, 7:50 pm
Newsgroups: comp.unix.shell
From: dave.gma+news...@googlemail.com.invalid (Dave Gibson)
Date: Tue, 30 Oct 2012 23:47:24 +0000
Local: Tues, Oct 30 2012 7:47 pm
Subject: Re: Can I doesn't use popt alias file for rsync, while use the alias function in-line/in-place with the rsync command?

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 must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ben Bacarisse  
View profile  
 More options Oct 30 2012, 11:09 pm
Newsgroups: comp.unix.shell
From: Ben Bacarisse <ben.use...@bsb.me.uk>
Date: Wed, 31 Oct 2012 03:09:11 +0000
Local: Tues, Oct 30 2012 11:09 pm
Subject: Re: Can I doesn't use popt alias file for rsync, while use the alias function in-line/in-place with the rsync command?

You may be right.  I asked three times for an example and someone else
provides it!  Just another day on Usenet.

--
Ben.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dave Gibson  
View profile  
 More options Oct 31 2012, 5:29 am
Newsgroups: comp.unix.shell
From: dave.gma+news...@googlemail.com.invalid (Dave Gibson)
Date: Wed, 31 Oct 2012 09:26:52 +0000
Local: Wed, Oct 31 2012 5:26 am
Subject: Re: Can I doesn't use popt alias file for rsync, while use the alias function in-line/in-place with the rsync command?

Modify rsync to allow a popt initialisation file to be specified in an
environment variable.  Use like this:

  echo "alias rsync -Z --no-p --no-g --chmod=ugu=rwX" > poptrc1
  RSYNC_POPTRC=poptrc1 rsync -aZv ...

  echo "alias rsync -Z --chmod=ugu=rwX" > poptrc2
  RSYNC_POPTRC=poptrc2 rsync -aZ ...

  # 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.

#v+
--- rsync-3.0.9/options.c.orig  2011-09-13 23:41:26.000000000 +0100
+++ rsync-3.0.9/options.c       2012-10-31 09:22:38.000000000 +0000
@@ -898,6 +898,7 @@
        const char *arg, **argv = *argv_p;
        int argc = *argc_p;
        int opt;
+       const char *rcf;

        if (ref && *ref)
                set_refuse_options(ref);
@@ -921,8 +922,12 @@
        if (pc)
                poptFreeContext(pc);
        pc = poptGetContext(RSYNC_NAME, argc, argv, long_options, 0);
-       if (!am_server)
-               poptReadDefaultConfig(pc, 0);
+       if (!am_server) {
+               if ((rcf = getenv("RSYNC_POPTRC")))
+                       poptReadConfigFile(pc, rcf);
+               else
+                       poptReadDefaultConfig(pc, 0);
+       }

        while ((opt = poptGetNextOpt(pc)) != -1) {
                /* most options are handled automatically by popt;
#v-


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Hongyi Zhao  
View profile  
 More options Nov 4 2012, 11:08 pm
Newsgroups: comp.unix.shell
From: Hongyi Zhao <hongyi.z...@gmail.com>
Date: Mon, 5 Nov 2012 04:08:33 +0000 (UTC)
Local: Sun, Nov 4 2012 11:08 pm
Subject: Re: Can I doesn't use popt alias file for rsync, while use the alias function in-line/in-place with the rsync command?

Oh, wonderful idea.  This is a real unixer/linuxer should do ;-)

Regards


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »