I've written a script to run intellij idea using an alias and put it in a .bashrc file.

function idea {
     sh /opt/idea-IU-135.909/bin/idea.sh

I am trying to run it through terminal and get the following message

rm: missing operand
Try `rm --help' for more information.

What am I doing wrong?

  • In your script you call rm. If you delete folder try with rm -rf. – 2707974 May 21 '15 at 6:55
  • what is your alias and how are you running it? I guess there should be some special character in the name? – Ron May 21 '15 at 6:55
  • Are you sure it's an sh script and not a bash script? – muru May 21 '15 at 8:17
  • @user3127896 it would be really helpful if you could copy the statement which is breaking in here. + Why arent you storing a real alias instead of a function? alias idea="sh /path/to/idea.sh" – Max Ruf May 21 '15 at 9:11

If my assumption is true,in your script, you may be trying to delete a folder or file whose name contains some special character. e.g., -myFile

In that case you have to edit that line in your script. There are two options to use rm in this scenario.

1.Use the -- which signifies the end of option flags

rm -- -myFile

2.Use full path

rm /home/you/directory/-r

or, from the same directory:

rm ./-r
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.