Home > OS >  A shell script great god help small white
A shell script great god help small white

Time:11-20

Delete state file and delete the file type in the picture the same file name such as the three 213037199 files inside the

CodePudding user response:

Rm - rf *. The state

CodePudding user response:

Ls *. The state | awk -f ". "' {print $1}
You shall take the prefix is above, you can assign a value to a variable, and then to delete

CodePudding user response:

refer to the second floor zhouchao6 response:
ls *. The state | awk -f. "" '{print $1}
You shall take the prefix is above, you can assign a value to a variable, and then to delete
must first determine any state file directory delete and delete any prefix the state file as all of the files

CodePudding user response:

#!/bin/bash
Ls -a | grep state & gt;/dev/null
If [$? - eq 0]; Then
X=$(ls -a | grep state | awk -f. "" '} {print $1 ')
For I in $x
Do
Rm - rf $i. *
The done
The else
Echo - e file does not exist! ""
Fi
  • Related