I have this file:
/root/.aria2/aria2.txt
and I want to move it to:
/var/spool/sms/outgoing/aria2_XXXXX
Note that XXXXX are random characters.
How do I do that using only the facilities exposed by the openwrt
(a GNU/Linux distribution for embedded devices) and the ash
shell?
A simple way of generating a semi-random number in bash is to use the
date +%N
command or the system provided$RANDOM
:or, using
$RANDOM
, you need to check you have sufficient digits for your purpose. If 5 is the number of digits you need:To move while providing the random suffix: