使用rm命令从终端删除〜$ filename.docx

时间:2020-03-28 22:34:12

标签: macos terminal ms-word echo rm

我在桌面目录中找到了一个名为“〜$ ew Digital Card.docx”的文件,该文件在外部终端不可见。这是名为“ New Digital Card.docx”的已删除单词文件的崩溃日志文件。 要先删除它,我尝试使用双引号echo

echo “~$ew Digital Card.docx”

输出:〜Digital Card.docx

cd Desktop/
rm ~\ Digital\ Card.docx

,然后用单引号echo

echo ‘~$ew Digital Card.docx’

输出:〜$ ew Digital Card.docx

cd Desktop/
rm ~$ew\ Digital\ Card.docx

但是在两种情况下,我都收到“没有这样的文件或目录” 错误。. rm 语法我错了吗?我该怎么办?

1 个答案:

答案 0 :(得分:1)

尝试 /* method arguments: stream : Stream class instance charSet: Character set (in string), default is current system encoding. bufferSize: Buffer size, default 1024 bytes */ static async Task<string> readStreamAsync(Stream stream, string charSet = "", int bufferSize = 1024) { /* read stream to buffers */ var buffer = new byte[bufferSize]; List<byte> buffers = new List<byte>(); using (var readStream = new StreamReader(stream)) { // read stream into buffer var n = await readStream.ReadAsync(buffer, 0, bufferSize); // loop buffer streaming until no more stream data while (n > 0) { // populate buffer into buffer list buffers.AddRange(new ArraySegment<byte>(buffer, 0, n).Array); // read stream into buffer n = await readStream.ReadAsync(buffer, 0, bufferSize); } } /* return encoded string */ if (String.IsNullOrWhiteSpace(charSet)) { // encode buffers array into default encoded string return Encoding.Default.GetString(buffers.ToArray()); } else { // encode buffers array into encoded string based on any character set return Encoding.GetEncoding(charSet).GetString(buffers.ToArray()); } } /* usage: */ string data; try { using (var receiveStream = response.GetResponseStream()) { data = await readStreamAsync(receiveStream, response.CharacterSet); } } finally { response.Close(); } Console.WriteLine(data); Statistic statistic = JsonConvert.DeserializeObject<Statistic>(data);

echo只是一个玩具,尝试过rm -rf './yourmask'吗?

阅读文件列表,考虑一下您的面具,然后重试。