Wednesday, 15 July 2015

linux - Adding current date and time into a bash script echo command -


I have a script that takes several hours to finish. I would like to add an existing date and time in a countermand command which prints the screen every time the stage is completed.

Then my command creates and incorporates approximately 20 databases. It takes several hours to insert some database, so I would like to print time to complete each stage on the screen so that you can know Where to be restored in this process. Even I have so far away.

  #! * .sql in db_file for / bin / sh Do mysqladmin $ {DB_File %% - *} Echo $ {DB_File %% - *} has been created Date +% x_% X mysql $ {DB_File %% - *} & lt; $ DB_File to enter $ DB_File in database dated in the date +% x_% X done  

Should work:

 for  in DB_File * .sql; Do mysqladmin $ {DB_File %% - *} has been created $ {DB_File %% - *} `date '+% F% T" `mysql $ {DB_File %% - *} & lt; $ DB_File is used by the  result  of the date command, using $ $ DB_File in the database using backquote. If you need any other date format, see what the "date --help" offer is. 


No comments:

Post a Comment