LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   rm command problem (https://www.linuxquestions.org/questions/linux-newbie-8/rm-command-problem-863615/)

eparl 02-18-2011 04:34 PM

rm command problem
 
if -i rm .o .y; in it113student; echo successful else echo failed fi
trying to get this to work ?

Reuti 02-18-2011 04:45 PM

What should this command sequence do in the end?

Tinkster 02-18-2011 04:45 PM

Hi, welcome to LQ!,

What is it meant to do? What language is it?


Cheers,
Tink

eparl 02-18-2011 05:56 PM

this is supposed to delete .o or.y file and answer if successful or failed this is in ubuntu terminal. any help is appriciated even if a link to a site that can explain this but I have been to a great number of sites and they are not real helpful.


Thank you for the advice and assistance

Tinkster 02-18-2011 06:07 PM

Quote:

Originally Posted by eparl (Post 4263311)
this is supposed to delete .o or.y file and answer if successful or failed this is in ubuntu terminal. any help is appriciated even if a link to a site that can explain this but I have been to a great number of sites and they are not real helpful.

And what part is the
Code:

in it113student
supposed to play?

MTK358 02-19-2011 07:15 AM

Quote:

Originally Posted by eparl (Post 4263248)
if -i rm .o .y; in it113student; echo successful else echo failed fi
trying to get this to work ?

What is the "-i" before the "rm" for??? If it's rm's intercative option, it must go after "rm" becasue it's and argument to rm. What you're saying now is to run the command named "-i" with the arguments "rm", ".o", and ".y".

What does the "in is113student" for? It's totally invalid syntax, and even if it was, there is no "in" command. If you meant the run this in the directory "it113student", you should run "cd it113student" before all this. Remember, prgramming languages are not like humen languages, computers can't "figure out" what you mean. It has to comply to an exact specification or the computer will get none of it.

If I correctly understood you wanted to do, I think this is what your script should look like:

Code:

cd it113student
if rm -i .o .y
then
    echo successful
else
    echo failed
fi


eparl 02-19-2011 02:05 PM

Thank you for the advice and assistance it's nice to see that someone is willing to help someone who is trying to learn this.


All times are GMT -5. The time now is 02:58 AM.