$ mkdir backup && mv * backup/
mv: cannot move `backup' to a subdirectory of itself, `backup/backup'
Works, but issues a warning. Also exit code is 1.
How to do it properly (but not [much] longer)?
shopt -s extglob
mkdir backup && mv !(backup) backup
Also bash, and sh (afaik):
$ mkdir .backup && mv * .backup/ && mv .backup backup
Sign up using Google
Sign up using Facebook
Sign up using Stack Exchange
5 years ago