Skip to content
Advertisement

bash ls output to file when ls finds no results

i’m relative new to scripting in bash, and made the following script:

JavaScript

At the end of the script, i don’t make a new MLSready file. When i execute the script, i expect to see the result of the latest ‘ls -l’ command in my logfile, however (because i didn’t create a new MLSready file?) the output is redirected to my prompt instead of to my logfile:

JavaScript

How can i arrange that the result of the latest ‘ls -l’ command is always redirected to my logfile?

I also tried with:

JavaScript

Below my logfile:

JavaScript

Thanks in advance!!

Advertisement

Answer

It’s the order:

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement