I'm trying to get my script to ls all the files in the form "$variable".*
the parameter is always a file with the extension .001 I want to find all the files with the same name but different extension, eg $file.002, file.003 etc. eg.:
first="$1"
others=${first%.001}
ls $others"*"
My problem is the file is named file[success].mpg.001
and what gets fed to ls is file[success].mpg* which gives me
ls: cannot access file[success].mpg*: No such file or directory
because ls needs to see:
file\[success\].mpg*
I've been trying everything, the one thing I did notice is ls fed the parameter $1 works, but not if fed $file after I've done file=$1 . So I guess how do I change the variable into a parameter?