Kia ora,
I have a build script where I do a bunch of file operations and if they succeed, I print stuff to stdout as part of a report generated for the build. However I am getting the error "mv: missing destination file operand after" a lot.
if mv $(ls *.md | grep -v _index.md) markdown; then
echo " Put Markdown files back in 'markdown'"
fi
I have been reading that it is usually people have just missed the destination part of the command, but in this case I don't think that I have.
Any advice would be appreciated!
$(ls *.md | grep -v _index.md)
- in bash, you could more robustly set thenullglob
andextglob
options i.e.shopt -s nullglob extglob
and then usemv -t markdown/ !(_index).md
I think – steeldriver Sep 09 '20 at 22:59ls *.md | grep -v _index.md
returns no matches, so that your command becomesmv markdown
– steeldriver Sep 09 '20 at 23:42