Expand "{file1,file2}"

Harald Becker ralda at gmx.de
Thu Apr 21 20:08:36 UTC 2011


 Hi Miguel!

>> On 21.04.2011 20:12, Miguel A. Reynoso wrote:
>>> strip src/{vpm,vpmbulk}
>>> Its possible use busybox ash applet with this expand commands ??.
>> Brace expansions are a bash-ishm extension not available in ash.
>>
> Thank's so much Harald.

You may consider to use the following construct:

for f in vpm vpmbulk
  do strip "src/$f"
done

This works in ash, bash and probably in any other POSIX compliant shell.
May be combined with globing features like in:

cd your_globing_base_directory
for f in xyz-* abc* u*.txt ??x??.*
  do put_your_commands_here_using "$f"
  # needs quoting of $f in case of space or special characters in file name
  # else not required
done

For more informations see ash (1) manual page (use Google etc. if you do
not have that manual page on your local machine).

--
Harald



More information about the busybox mailing list