finds first argument usually is the path where to start the search. You have * as first argument so all entries in your current working directory are passed as argument.
If you want your script to start searching in the current directory use the dot or even better use the absolute path where to start (especially when you execute rm on hits).
or
hey, I have to write a housekeeping script which would delete any files which are more than 10 days old, the file is named in such a fashion
MYTEST20060101_182239.txt
MYXML20060112_182879.xml
MYEXCEL20060113_546321.xls
If the current date is 20060112, then MYTEST20060101_182239.txt will be... (2 Replies)
Help. My script is working fine when executed manually but the cron seems not to catch up the command when registered.
The script is as follow:
#!/bin/sh
for file in file_1.txt file_2.txt file_3.txt
do
awk '{ print "0" }' $file > tmp.tmp
mv tmp.tmp $file
done
And the cron... (2 Replies)
I have a directory ( eg. /tmp , there are many files in it , I would like to do the houskeeping job , can advise how to develop a script to do the following .
1) if the files are elder than 10 days in this directory , the extension is .txt , then move it to /tmp/tmp-txt , the same , if the files... (2 Replies)
I am trying to automate a script where I need to use pbrun /bin/su but for some reason it is not passing thru the pbrun as my code below.
. ~/.bash_profile
pbrun /bin/su - content
c h 1
hpsvn up file path
I am executing this from an external .sh file that is pointing to this scripts file... (14 Replies)
I have noticed that after I clear up the /var filesystem, there are always problems.
Does deleting the OLDsyslog.log file cause problems like missing directories and problems accessing crontabs?
There were two situations where I faced problems.
1) Deleted OLDsyslog.log (Of course I created... (5 Replies)
Hello, Newbie here,
I have a perfectly well working web service call I can issue from chrome (PC Windows 10) and get the results I want (a dimmer being turned on in Fibaro Home Center 2 at level 40)
I am not allowed to post urls but the below works with http and :// and... (3 Replies)
Hi Team,
I have written the shell script which returns the result of the disk space filesystems which has crossed the threshold limit in HTML Format. Below mentioned is the script which worked perfectly on QA system.
df -h | awk -v host=`hostname` '
BEGIN {
print "<table border="4"... (13 Replies)
We have regularly questions about how to create users and user accounts. But regularly user accounts need to be deleted too. It is quite easy to delete the user account itself but usually the HOME directory of the user remains.
It is good style to remove these directories but simply deleting... (3 Replies)