So you've written a shell script that relies upon non-POSIX
behavior, specifically GNU bash extensions, and it doesn't
work in POSIX-ey ash. No big surprise. You will have to
do it differently, or install bash on your target. Same
dilemma everybody else faces when dealing with 'small' targets.
What's _wrong_ with this kind of thing:
P=/tmp/test cp -f $P/a $P/b $P/c ... dest/
anyway? (I used $P to cut down the source line length, but
it's totally unnecessary to the functionality.) It's not
like you have to get everything done in one command, either.
The cp command is not some kind of atomic operation. Are you
after a fewest-line-count award?
-- Jim
-----Original Message-----
From: busybox [mailto:[email protected]] On Behalf Of David Henderson
Sent: Monday, November 21, 2016 2:07 PM
To: Grant Edwards
Cc: [email protected]
Subject: Re: copying multiple files
Thanks again for your continued help Grant. Unfortunately the file
names are not actually similar as in the example (e.g. help.txt,
world.png, ...) so using braces won't help either. Any other
thoughts? Currently I'm forced to use a combination of find and cp -
ugh - just to reduce the number of lines necessary for the
operation...
Thanks,
Dave
On 11/21/16, Grant Edwards <[email protected]> wrote:
> On 2016-11-21, David Henderson <[email protected]> wrote:
>> On 11/21/16, Grant Edwards <[email protected]> wrote:
>>> On 2016-11-21, David Henderson <[email protected]> wrote:
>>>
>>>> cp -f /tmp/test/{a.txt,b.txt,c.txt} /tmp/test2/{1.txt,2.txt,3.txt}
>>>> /tmp/dest
>>>
>>>> This keeps failing. Is this implemented in BB?
>>>
>>> Try this:
>>>
>>> $ busybox ash
>>> ~ $ echo /tmp/test/{a.txt,b.txt,c.txt}
>>> /tmp/test/{a.txt,b.txt,c.txt}
>>>
>>> It appears that the busybox shell does not implement bash/C shell
>>> alternation (aka "brace expansion"). None of the busybox builds I
>>> have on hand do anyway, and I don't see any options in the config file
>>> to enable such a feature...
>
>> Hey Grant, thanks for the reply! Unfortunately that command will just
>> echo what you type to the screen, not actually copy anything.
>
> I know. I was showing you how to determine if alternation (brace
> expansion) wasn't happenning. It doesn't on any of my builds of
> busybox.
>
>> Any other thoughts?
>
> Don't try to use alternation:
>
> cp -f /tmp/test/[abc].txt /tmp/test2/[123].txt /tmp/dest
>
> --
> Grant Edwards grant.b.edwards Yow! ... I think I'd
> at better go back to my
> DESK
> gmail.com and toy with a few
> common
> MISAPPREHENSIONS ...
>
> _______________________________________________
> busybox mailing list
> [email protected]
> http://lists.busybox.net/mailman/listinfo/busybox
>
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox