0

I just started Bash scripting yesterday, and I've run into a problem, my instructor told me to redirect a list of all .mp3 and .mp4 files that are contained in a folder to a .txt file, I can do that just fine, with:

    #!/bin/bash
    (cd /root/Desktop/Example/Multmedia/ && ls *.mp3 >> list.txt && ls *.mp4 >> list.txt)

but the thing that is confusing me, is that he also asked to add a column to the left showing the line number, I know that I should probably use $LINENO to show it, but, how do I add it before each entry on the list? so it shows something like this:

1 Audio1.mp3
2 Audio2.mp3
3 Video1.mp4

And so on, thanks a lot.

Joseko
  • 1
  • 1

0 Answers0