General
cancel
Showing results for 
Search instead for 
Did you mean: 

create a bourne shell script called myrm

newbie19
Occasional Visitor

create a bourne shell script called myrm

i am a newbie to this, i have a assignment that says create a bourne shell script called "myrm"
this rm like command will not delete a file but will move it to the directory. anybody know how to do this?
5 REPLIES
Duncan Edmonstone
Honored Contributor

Re: create a bourne shell script called myrm

By assignment, I presume you mean an academic assignment as part of a course in UNIX yes?

If that's the case, surely the point of the assignment is for you to learn how to do this yourself by understanding some basic principles of shell scripting, rather than getting an answer from a forum.

That said, I'm sure some desperate points scroungers will be along in a minute to provide you with the answer.

grumble grumble... never happened in my day grumble grumble

Duncan

HTH

Duncan
Duncan Edmonstone
Honored Contributor

Re: create a bourne shell script called myrm

... and googling

shell scripting course

turns up plenty of free learning resources

HTH

Duncan

HTH

Duncan
Rita C Workman
Honored Contributor

Re: create a bourne shell script called myrm

Hello Newbie,

Welcome to the Forums! But I must join Duncan in saying that if you have an assignment you need to open the student workbook and find the command your instructor told you to learn.

Cause "man move" is not it. And, actually, the command to move is not the most highly recommended, as if anything goes wrong during the operation...poof file gone! I tend to "copy" to new location and then "remove" from old.

Get used to opening a book and find the commands. Cause that's what UNIX Admin's do...we read/research & implement.

Rgrds,
Rita

Steven Schweda
Honored Contributor

Re: create a bourne shell script called myrm

> [...] anybody know how to do this?

Yes.
Laurent Menase
Honored Contributor

Re: create a bourne shell script called myrm

you mean replace rm by mv?

or something as simple as:
#!/usr/bin/ksh

if [ -d ~/trashbin ]
then
mkdir ~/trashbin
fi
mv $* ~trashbin