You don't have to call 'test this' all the time, any sane shell should have lots of operators built in. [ -d "~/.recyclebin" ] || mkdir "~/.recyclebin" sort of thing. See test operators for a table of them. A few of them might be peculiar to BASH, most'll work anywhere.
You can also use the -p option to mkdir to simplify that more. If the directory already exists it does nothing.
I am creating a simple script that can "recover" a deleted file.
I already created a working del command wherein when I type
, the filename will be moved to a directory called recyclebin.
Now, in order for me to recover this file, I need to search for the filename inside the recyclebin and move it to the destination that the user will specify.
unfortunately the code does not work
What is wrong with my code?
I just want the script to be executed something like this:
For future reference, "doesn't work" isn't a good description. That has meant anything from "too slow" to "on fire" in my experience, more detail would be helpful But several problems show themselves on first look:
That's not how if works. You're missing the then:
That's not how find works either. I can't tell what you're even trying to do.
You can't use continue anywhere that's not in a loop, and I don't know what you were trying to do with it there.
Hi.
I've created scripts for a recycle bin that can list, restore and empty it. I only have the problem of deleting two files with the same name. When I do it one file overwrite the other. What could I do to resolve it? The only thing I can think is asking the user to rename file before moving to... (2 Replies)
Hi.
I'm started to use minix 3.2.1 recently and I'm trying to create a recycle bin for it. I'm kinda struggling on how to do it. I searched internet and I found scripts created for it but I actually didn't learn how to create scripts in college and I'm not sure if I understand them. I just wanted... (1 Reply)
Q1. I understand that /usr/local/bin means I can install/uninstall stuff in here and have any chance of messing up my original system files or effecting any other users. I created this directory myself.
But what about the directory I didn't create, namely /Users/m/bin? How is that directory... (1 Reply)
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
A set of Linux shell scripts is required to allow users to ‘remove' files without them really disappearing until... (8 Replies)
Hello,
I have having problems with an assignment and am pretty desperate. My assignment is to create a shell script that does a Recycle_Bin tasks. You can only open this with PuTTY software or Knoppix. Perhaps on other software that are able to read linux language.
My part is stuck... (2 Replies)
Hello, I'm only taking Intro to UNIX in school right now, so please bear with me. My problem is with a sort-of recycle-bin rig I've created for fun. I'm using Ubuntu 9.04, I am the admin. (only user, actually) of this computer. I'm using this script in ~/.bashrc
# if files exist, remove contents... (6 Replies)
hello everybody,
I am trying to find the path of the Recycle Bin. I know that it's a temporary storage place, but it should have a path that we can refer to.
I want to know it because I sometimes use cygwin to work on Windows, and when you delete something with it, it's gone. I just checked... (4 Replies)
How do we view th ecode for executables??
qwk,grep.fgrep, etc..
any ideas??
as they are written in C , I think , there should be some place where they are placed. (2 Replies)