View Full Version : A wtf ...
slavik
March 23rd, 2009, 01:33 AM
The following is true and actually happened, multiple times ... (it was in cron set to run monthly)
script goes as follows:
cd /dir1/dir2
wget http://somesite.com/tarball.tar
tar xf tarball.tar
cd *
cd dir3
command somefile
command another_file
cd ..
cd ..
rm -rf *
ghostdog74
March 23rd, 2009, 01:58 AM
and the problem is the rm -rf * ?
linuxisevolution
March 23rd, 2009, 02:04 AM
The following is true and actually happened, multiple times ... (it was in cron set to run monthly)
script goes as follows:
cd /dir1/dir2
wget http://somesite.com/tarball.tar
tar xf tarball.tar
cd *
cd dir3
command somefile
command another_file
cd ..
cd ..
rm -rf *
I was like wtf too until I saw the last line... lmao made my day :)
jimi_hendrix
March 23rd, 2009, 02:06 AM
you told me the guy who wrote that was a grad from some great school too right :)
slavik
March 23rd, 2009, 05:38 AM
well, there were a couple of "great school e-mails in there" (new york area).
btw, the rm -rf * by itself is not a problem ... the problem appears earlier.
DocForbin
March 23rd, 2009, 05:50 AM
what is cd * supposed to do, go to the first directory I guess?
samjh
March 23rd, 2009, 06:13 AM
what is cd * supposed to do, go to the first directory I guess?
Yup.
I'm guessing the "tar xf" is the WTF line (note the lack of "-" for the parameters).
tneva82
March 23rd, 2009, 07:08 AM
Yup.
I'm guessing the "tar xf" is the WTF line (note the lack of "-" for the parameters).
What is that supposed to do? Created temp directory and copied tar file there and tried it. It unpacked without issues. Why should that be WTF line?
Xiong Chiamiov
March 23rd, 2009, 07:09 AM
Yup.
I'm guessing the "tar xf" is the WTF line (note the lack of "-" for the parameters).
You don't need - for flags with tar, for some odd reason. In fact, I almost always see it without.
sujoy
March 23rd, 2009, 07:12 AM
lol @
cd ..
cd ..
why couldn't he just do a cd ../.. ? or pass the path to rm?
samjh
March 23rd, 2009, 02:18 PM
What is that supposed to do? Created temp directory and copied tar file there and tried it. It unpacked without issues. Why should that be WTF line?
You don't need - for flags with tar, for some odd reason. In fact, I almost always see it without.
Oh well, scrap it. :p
Simian Man
March 23rd, 2009, 02:23 PM
The WTF is it downloads and unpacks a tarball, then runs a few commands only to delete the whole thing moments later. You guys can't see the forest for the trees :).
Powered by vBulletin® Version 4.2.2 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.