Hi, I have a problem with my script: its aim is to find a avi file with a particular extension, and to generate a link in the tmp directory.
Here's the code:
for media in $Path; do
if [ $media != "SETTINGS" ]; then
files=$(find /media/$media/ -print -type f | tr ' ' '#')
for video in $files; do
if [ $extension == avi ]; then
video=$(echo $video | sed 's/#/\\\ /g')
echo "File found: "$video
ln -s $video /tmp/video
The script works fine only if the name of the file doesn't include dashes (-).
If the file contains (-) the script gives me the following error:
ln: invalid option -- '\'
seems that the script interpretes the dash like an option. How can I fix this?
Thank you in advance, and sorry for my english