[colug-432] Command Line Arguments (was Re: rsync include/exclude)
jep200404 at columbus.rr.com
jep200404 at columbus.rr.com
Mon Mar 9 16:57:58 EDT 2015
On Wed, 4 Mar 2015 20:04:32 -0600, Richard Hornsby <richardjhornsby at gmail.com> wrote:
> So, essentially, the problem was that inside of a shell script
> I was building the —include= rsync arguments for later use.
> I was wrapping the right side in quotes, like so
>
> —include=“*.log-2015-*"
>
> rsync was using these quotes literally.
Use echo to see what rsync thinks it is getting.
[test at colug hornsby]$ echo rsync '*'
rsync *
[test at colug hornsby]$ echo rsync "*"
rsync *
[test at colug hornsby]$ echo rsync *
rsync foo
[test at colug hornsby]$
Or use something like my showargs
to see what rsync thinks it is getting.
[test at colug hornsby]$ cat ~/util/showargs.c
#include <stdlib.h>
#include <stdio.h>
int main(int argc,char *argv[])
{
int i;
for (i=0;i<argc;i++)
printf("argv[%d]=\"%s\"\n",i,argv[i]);
return EXIT_SUCCESS;
}
[test at colug hornsby]$ ~/util/showargs rsync '*'
argv[0]="/home/jep/util/showargs"
argv[1]="rsync"
argv[2]="*"
[test at colug hornsby]$ ~/util/showargs rsync "*"
argv[0]="/home/jep/util/showargs"
argv[1]="rsync"
argv[2]="*"
[test at colug hornsby]$ ~/util/showargs rsync *
argv[0]="/home/jep/util/showargs"
argv[1]="rsync"
argv[2]="foo"
[test at colug hornsby]$
> —include=“*.log-2015-*"
By the way, that first double quote is not the same as the
second double quote. Your first double quote character is a
three byte sequence E2 80 9C in UTF-8. I think to a shell,
that's just another character, not a double quote.
[test at colug hornsby]$ echo '—include=“*.log-2015-*"' | xxd -g 1 -u
0000000: E2 80 94 69 6E 63 6C 75 64 65 3D E2 80 9C 2A 2E ...include=...*.
0000010: 6C 6F 67 2D 32 30 31 35 2D 2A 22 0A log-2015-*".
[test at colug hornsby]$
Is that how you sent the email?
More information about the colug-432
mailing list