0
Using shell script, I am creating a file script.sh
that automates some tasks for me. In it I need to draw a file from the current directory to perform some tasks. I’m drawing the file with the command below:
shuf -n1 -e $(ls)
The code works perfectly when the file name does not contain whitespace (eg: relatorio.pdf
). However, for whitespace files (e.g.: relatorio mensal.pdf
), the draw ends up breaking the file name (in my example, it is relatorio
and mensal.pdf
).
I would like the command shuf
draw and always return the full name of the file, even if it contains blank space. Someone knows how to do this?