Home > Back-end >  The unknown garbled
The unknown garbled

Time:12-03

Below is a shell code, mainly in order to simplify the trans command, and can choose the output content input to a file

 
Read the word
The content=$(trans useful: en $word)
Echo "$content
"Read option
If [$option='y']; Then
Result=${the content//m/}
Result=${result//[0-9]/}
Result=${result////}
Result=${result///}
Echo "$result & gt;"> ~/Documents/trans_history
Echo - e "\ n" & gt;> ~/Documents/trans_history
The exit 0
The else
The exit 0
Fi


Terminal output below


Input to a file with the code, below are the results to filter out the part of the garbled characters, there is still a garbled characters ^ [,


I am confused ^ [is a character, whether filter ^ or [are not, and the characters in neovim, nano etc exist in the editor, also can search through the editor to ^ character, but with a plain text editor open does not exist

In addition, also want to consult the use of regular expressions or symbol in the shell code, I have tried a result=${result///|/}, the result=${result///|/}, the result=${result//[\ |]/}, the result=${result///\ \ |/}, etc., the results are not correct
  • Related