Keeping it simple: You know by now that "rm" removes a file, permanently !
Wouldn't it be nice if we could move it to the recycle bin with a simple command instead ?
We're gonna make that command and call it: "del"
( YES ! making our own commands ! )
First a little script:
CODE
$ vi /usr/bin/del
"i"
Here is the text for the script:
QUOTE (Text @ Script)
#!/bin/bash
mv $1 ~/Desktop/Trash
#End script
<>
"ZZ"
Make it executable
CODE
# chmod 0775 /usr/bin/del
Now if we do
CODE
$ del tessst
( It will execute the script and do the same as: )
CODE
$ mv tessst /home/bruno/Desktop/Trash
Sure this was a very short example, a 3 line script, it only holds one command, but you could put as many lines in the script as you want and execute it with a four letter word.
If there are more commands in the script it will execute them in the order that they are noted down.
Because /usr/bin is in your "path" you only have to type "del" to execute it.
If you have to do complicated commands in a certain order on a regular basis, make a little bash script, put it in your "path" and give it a name that's easy to remember.
Next time we'll make a simple backup script, to backup and gzip the contents of your /home directory.
Categories
- GNU/Linux (20)
- Linux Security (12)
- Ubuntu Tutorials (20)
- Web Browsers (1)
- Windows 2000 (20)
- Windows 2003 (13)
- Windows 7 (8)
- Windows Vista (43)
- Windows XP (54)
Bookmark us
Wednesday, October 1, 2008
BASH SCRIPT
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment