Hello All,

I could use some help, I am trying to write a small script for my mythTV dvr but I am in over my head (I am new to bash scripting),

I am trying to run "ls -tr *.avi | tail -10" to get a list of the last 10 movies I have added, and then to a ln -s of the list to create a symlink of each file to a directory.

The issue is if I do theItems=`ls -tr *.avi | tail -10` They are a single string, so I tried "set -- $theItems" but spaces in file names become a value.

Can anyone give a direction/assistance to how I might be able to do this?

Thanks
Bryan

Never Mind, I found xargs to be easier

ls -tr *.avi | tail -10 | xargs -I{} ln -s /Video_Media/{} /Video_Media/Newest/
In case anyone cares ;)

Thanks

Bryan

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.