I have a directory contains some svg images among its contents. I list them with following ls
command to save the output in a file:
ls *200px.svg > animList.js
The output file looks like:
file1-200px.svg
file2-200px.svg
file3-200px.svg
...
fileX-200px.svg
I need the file name to be written like 'fileX-200px.svg',
to easily make this files list working like JavaScript array. i.e. I need the output file to be:
'file1-200px.svg',
'file2-200px.svg',
'file3-200px.svg',
...
'fileX-200px.svg',
So at the end I just need to add something like var arr = [
at the beginning of the file and then add ];
at the end of the file to work as JavaScript array. Is there any way in Linux to control the output display of the ls
command?