4

I have a java class file that is causing problems because of the length of the name:

GroundTransportationProductType$GroundTransportationOptions$GroundTransportationProductOption$GroundTransportationOptionProviderLinks$ProviderLinks.class

I have managed to get the file on the unix box (Solaris) by under a shortend file name. my.class

How can I rename my.class to the correct class name above?

Using mv and cp normally (ie not doing something for the dollar signs) does not work. I have googled and searched extensively but cannot find anything on how to create a file with a dollar name in it on unix.

Thanks,

Kenny

km2000
  • 305
  • 2
  • 10

1 Answers1

6

$ has a special meaning in shells, so you need to escape it somehow. The best option would be to use single quotes around your filenames. A \ in front of the '$' sign would also work.

mv my.class 'Long$File$Name.class'

or

mv my.class Long\$File\$Name.class
chepner
  • 497,756
  • 71
  • 530
  • 681
Costi Ciudatu
  • 37,042
  • 7
  • 56
  • 92