Renombrar fichero que empieza con guión “-“

Posted on desembre 21st, 2015 by admin

Al ejecutar un comando se me ha creado un fichero llamado “–logpriority” y al borrarlo me decía

root@blackhold:/etc/pve/lxc# rm "--logpriority" 
rm: unrecognized option '--logpriority'
Try 'rm ./--logpriority' to remove the file ‘--logpriority’.
Try 'rm --help' for more information.
root@blackhold:/etc/pve/lxc# mv "--logpriority" lala
mv: unrecognized option '--logpriority'
Try 'mv --help' for more information.

Con y sin comillas me soltaba este error, la solución ha sido hacer esto:

root@blackhold:/etc/pve/lxc# mv ./--logpriority lala
root@blackhold:/etc/pve/lxc# ls
100  100.conf  101  101.conf  102  102.conf  lala
root@blackhold:/etc/pve/lxc# rm lala

Y listos!

This entry was posted on dilluns, desembre 21st, 2015 at 22:15 and is filed under bash. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

« »

guy fawkes