Συντονιστής: konnn
sudo chmod +x script.sh
Black Fox έγραψε:script´ :no such file or directory
gksudo nautilus
#!/bin/bash
args=$#
if [ "$args" -ne 1 ]; then
echo "This script works with only one parameter!"
else
filename=$1
test=1
if [ -f "$filename" ]; then
echo "The file exists.That's good!"
else
echo "The file doesn't exist or it isn't regular!"
test=0
fi
if [ -O "$filename" ]; then
echo "The file is yours.That's good!"
else
echo "The file is not yours!"
test=0
fi
echo
if [ $test -eq 0 ]; then
echo "Sorry,i can't do this!"
else
if [ ! -d ~/.my-trash ]; then
echo "Directory my-trash not found!"
echo "Creating directory my-trash..."
mkdir ~/.my-trash
fi
echo "Moving${filename} in trash directory..."
newfilename='date +%y%V'$filename
mv ./$filename ~/.my-trash/${newfilename}
fi
fi
exit