[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: xargs prompts with the same string, but executes differently
From: |
Assaf Gordon |
Subject: |
Re: xargs prompts with the same string, but executes differently |
Date: |
Tue, 23 Jul 2019 12:31:45 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 |
Hello,
On 2019-07-23 9:59 a.m., 積丹尼 Dan Jacobson wrote:
Proof that xargs prompts with the same string, but executes differently:
$ echo 0 0 | xargs -p -I{} xdotool mousemove {} click 1 mousemove restore
xdotool mousemove 0 0 click 1 mousemove restore ?...y
xdotool: Unknown command: 1
Run 'xdotool help' if you want a command list
$ echo | xargs -p xdotool mousemove 0 0 click 1 mousemove restore
xdotool mousemove 0 0 click 1 mousemove restore ?...y
$ xargs --version
xargs (GNU findutils) 4.6.0.235-f254 ...
This is not about "-p", but simply that "{}" puts the entire input line
("0 0") as a single parameter (as if quoted).
The correct comparison is:
echo | xargs -p xdotool mousemove 0 0 click 1 mousemove restore
vs
echo | xargs -p xdotool mousemove "0 0" click 1 mousemove restore
The following short script will help you investigate such cases in
the future:
$ cat show-args
#!/bin/sh
i=1
while test $# -gt 0 ; do
echo arg $i: $1
shift
i=$((i+1))
done
$ echo 0 0 | xargs -I{} ./show-args xdotool mousemove {} click 1
mousemove restore
arg 1: xdotool
arg 2: mousemove
arg 3: 0 0
arg 4: click
arg 5: 1
arg 6: mousemove
arg 7: restore
$ echo | xargs ./show-args xdotool mousemove 0 0 click 1 mousemove
restore
arg 1: xdotool
arg 2: mousemove
arg 3: 0
arg 4: 0
arg 5: click
arg 6: 1
arg 7: mousemove
arg 8: restore
regards,
- assaf
- xargs prompts with the same string, but executes differently, 積丹尼 Dan Jacobson, 2019/07/23
- Re: xargs prompts with the same string, but executes differently,
Assaf Gordon <=
- Re: xargs prompts with the same string, but executes differently, Eric Blake, 2019/07/23
- Re: xargs prompts with the same string, but executes differently, 積丹尼 Dan Jacobson, 2019/07/23
- Re: xargs prompts with the same string, but executes differently, James Youngman, 2019/07/24
- Re: xargs prompts with the same string, but executes differently, Eric Blake, 2019/07/24
- Re: xargs prompts with the same string, but executes differently, Bernhard Voelker, 2019/07/24
- Re: xargs prompts with the same string, but executes differently, Eric Blake, 2019/07/24
- Re: xargs prompts with the same string, but executes differently, 積丹尼 Dan Jacobson, 2019/07/25
- Re: xargs prompts with the same string, but executes differently, James Youngman, 2019/07/25
- Re: xargs prompts with the same string, but executes differently, 積丹尼 Dan Jacobson, 2019/07/25