简体   繁体   中英

Linux: what does minus asterisk -* mean in bash script

Linux: what does minus asterisk -* mean in a bash script in the end of line:

tar -czvf  $pfad/toolkitdb.log.`date -d "yesterday" +%Y-%m-%d`.tar.gz toolkitdb.log.`date -d "yesterday" +%Y-%m-%d`*
rm $pfad/toolkitdb.log.`date -d "yesterday" +%Y-%m-%d`-*

Thank you!

This means it will remove all the files ending with yesterday's date, a - and then any character, like

$pfad/toolkitdb.log.2017-07-09-14/
$pfad/toolkitdb.log.2017-07-09-test/

You have to replace $pfad with the correct value.

For instance, you could try the command:

ls $pfad/toolkitdb.log.`date -d "yesterday" +%Y-%m-%d`-*

to see the output files.

dash (-) has no special meaning there. start (*) will match any characters any number of times, so its just a wild card for "match anything after -" in this case they expect numbers

Insert-Completions (M-*)
Insert all completions of the text before point that would have been generated by possible-completions.

Source: https://tiswww.case.edu/php/chet/bash/bashref.html#index-insert_002dcompletions-_0028M_002d_002a_0029

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM