I run a command from which I expect that if the file exists, then it will move to the save folder

$ (if [ -f "new.sql" ]; then mv new.sql save/$(date +%s).sql; exit 33; fi); 

I get an error message

$ (if [-f "new.sql"]; then mv new.sql save / $ (date +% s) .sql; exit 33; fi); mesg: ttyname failed: Invalid argument ERROR: Job failed: Process exited with: 1. Reason was: ()

  • at least a comment before dizlykat, what's wrong with the question? - Serge Esmanovich
  • @ D-side corrected the question, so clearer? - Serge Esmanovich
  • Add a lsof check to your base if it is active and you move it, it is not guaranteed that it will move correctly. - Hellseher
  • @Hellseher thanks - Serge Esmanovich September

1 answer 1

Sort of

 ls new.sql && mv new.sql save/$(date +%s).sql 
  • Thanks, I'll try - Serge Esmanovich September