Article 560EE Looking for guidance on generating an script to randomize the greetings file

Looking for guidance on generating an script to randomize the greetings file

by
elnetotaca
from LinuxQuestions.org on (#560EE)
Whats up guys, I am trying to figure out how to generate an script that will choose and randomize within 10 different .mp3 files to play as the main greetings file on my laptop.

so far this is how much I've gotten....(I know, not far, lol)

#!?bin/bash
original=greetings.mp3
rename=raNum

#It will randomize within 10 greeting files.
ranNum=$[1 + RANDOM % 10]

[ $(mv -i $original $ranNum) ]

I want to do this keeping the previous file, as you can see, right now I am just replacing greetings.mp3 to a number generated by the function, but obviously that is not exactly what I want to do.
any ideas???
I will appreciate VERY MUCH the help.
THANKS!

EDIT.

progress!!!!

#!?bin/bash
original=greetings.mp3
$2=
#It will randomize within 10 greeting files.
ranNum=$[1 + RANDOM % 10]

#swap names
function swap()
{
local TMPFILE=tmp.$$
mv "$original" $TMPFILE && mv "$2" "$1" && mv $TMPFILE "$2"
}

now I'm stuck, lol

Edit #2

#!?bin/bash
original=greetings.mp3

#It will randomize within 10 greeting files.
ranNum=$[1 + RANDOM % 10]

if raNum=1
{$2=1.mp3
if raNum=2
{$2=2.mp3
if raNum=3
$2=3.pm3
#swap names
function swap()
{
local TMPFILE=tmp.$$
mv "$original" $TMPFILE && mv "$2" "$1" && mv $TMPFILE "$2"
}
I feel like I'm moving forward, but there's gotta be an easier way....latest?d=yIl2AUoC8zA latest?i=Q0Nn-C01kss:2a0cQhknnPI:F7zBnMy latest?i=Q0Nn-C01kss:2a0cQhknnPI:V_sGLiP latest?d=qj6IDK7rITs latest?i=Q0Nn-C01kss:2a0cQhknnPI:gIN9vFwQ0Nn-C01kss
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments