在Linux中无法复制名称为"$"的文件 [英] Unable to copy a file with '$' in name in Linux

查看:392
本文介绍了在Linux中无法复制名称为"$"的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的Linux目录中,有一个名为TopSample$Config.class的文件. 每当我尝试将此文件复制到另一个位置/目录时,都不允许我这样做.

Inside of my Linux directory, I have a file named TopSample$Config.class. Whenever I try to copy this file to another location/directory, it is not allowing me to do so.

我正在这样做:

cp TopSample$Config.class /home/praveen/com/config/

如果无法实现,请告诉我.

Please let me know if this isn't possible.

推荐答案

shell会将$Config解释为变量.它将扩展为空字符串.
您可以将单引号引起来以保持字面值:

The shell will interpret $Config as a variable. And it will expand to empty string.
You can put single quotes around to keep the literal value:

cp 'TopSample$Config.class' /home/praveen/com/config/

另一种方法是使用\(反斜杠)转义$(美元符号)

Another way is to escape the $(dollar sign) by using \(backslash)

cp TopSample\$Config.class /home/praveen/com/config/

这篇关于在Linux中无法复制名称为"$"的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆