Bash script, im still new to linux
by Himeose from LinuxQuestions.org on (#55AK0)
How to append an existing file?
The existing file in the mywastebasket will have the version number zero appended to it and the newly deleted file will have version number 1 appended to it.
How the loop looks like?
My code be like
#!/bin/sh
read file
mv $file mywastebasket
rm -i /home/himeose/mywastebasket/
So how am i gonna proceed?
Read file from home
At /home/himeose/mywastebasket
I will code this after the bash done
touch home.txt
bash delete.sh
home.txt
Are you sure to delete or not? y
Move the file (at home) to directory (mywastebasket is dir)
Yes we are at /home/himeose/
After rm - i /home/himeose/mywastebasket/
The loop
Mybe i should use
If [ conditional expression1 ]
then
statement1
statement2
.
elif [ conditional expression2 ]
then
statement3
statement4
.
.
.
else
statement5
fi
After the file name appended
I can clear all the file in the mywastebasket dir.
By using alias rm - c = "rm -v"


The existing file in the mywastebasket will have the version number zero appended to it and the newly deleted file will have version number 1 appended to it.
How the loop looks like?
My code be like
#!/bin/sh
read file
mv $file mywastebasket
rm -i /home/himeose/mywastebasket/
So how am i gonna proceed?
Read file from home
At /home/himeose/mywastebasket
I will code this after the bash done
touch home.txt
bash delete.sh
home.txt
Are you sure to delete or not? y
Move the file (at home) to directory (mywastebasket is dir)
Yes we are at /home/himeose/
After rm - i /home/himeose/mywastebasket/
The loop
Mybe i should use
If [ conditional expression1 ]
then
statement1
statement2
.
elif [ conditional expression2 ]
then
statement3
statement4
.
.
.
else
statement5
fi
After the file name appended
I can clear all the file in the mywastebasket dir.
By using alias rm - c = "rm -v"