Page 1 of 1

How can I creat a logfile? SOLVED

Posted: Sat 22 Mar 2014, 15:44
by oldyeller
Hello Everyone,

I would like to know how I can make a file with a name of a pet as the name of the file with the file not having any thing written on it. What I want is to have a file in the dir where the pet gets downloaded so the it can't get downloaded again once it has been moved.

I am sure there is probably a better way of doing this.

Code: Select all

#!/bin/sh


mkdir /root/Downloads/sfs

cd /root/Downloads/sfs

if [ -f /root/Downloads/sfs/devx_fluxpup_1.5.sfs ]; then
Xdialog --msgbox "All ready downloaded" 0 0
else
rxvt -geometry 130x10+0+0 -bg black -fg green -e wget -4 -t 2 -T 20 http://smokey01.com/Oldyeller/FluxPup/devx_fluxpup_1.5.sfs
Xdialog -title="Move"  --yesno "Do you have a savefile" 0 0
if [ $? -eq 0 ]; then
Xdialog -title="Move"  --yesno "Do you want to move file to mnt/home" 0 0
if [ $? -eq 0 ]; then
mv /root/Downloads/sfs/devx_fluxpup_1.5.sfs /mnt/home then
Xdialog --msgbox "Finished" 0 0
fi
fi
fi
exit 0

Posted: Sat 22 Mar 2014, 15:59
by amigo
Usually you'd see 'touch' used for this:
touch name-of-file
But, you can also simply do:
: > name-of-file
or:
> name-of-file
cat /dev/null > name-of-file
echo "" > name-of-file

All the above create an empty file.

Posted: Sat 22 Mar 2014, 19:34
by oldyeller
Thanks amigo,

That worked just fine.

Cheers