1.11M Members

a question on a bash script

 
0
 

I am trying to understand one test script, which includes

if [ ! -f mahout-work/reuters21578.tar.gz ]; then
echo "Downloading Reuters-21578"
curl http://kdd.ics.uci.edu/databases/reuters21578/reuters21578.tar.gz \
                     -o mahout-work/reuters21578.tar.gz
fi

What does the condition of

! -f mahout-work/reuters21578.tar.gz

mean? And what does

curl http://kdd.ics.uci.edu/databases/reuters21578/reuters21578.tar.gz \ -o mahout-work/reuters21578.tar.gz

stand for? Thanks.

 
0
 

Basically in the first part of the code the condition in the if statement says "if the file reuters21578 does not exist in the mahout-work directory"
Note: The ! is the logical NOT operator.


If the file does not exist in the specified directory the code under the if statement (the 2nd part you wanted understand) uses the program curl to download the file from a website and saves it in the mahout-work directory.

 
0
 

What does the condition of
(Toggle Plain Text)
! -f mahout-work/reuters21578.tar.gz
mean? And what does

it means that if the mahout-work/reuters21578.tar.gz is not a file (i.e does not exist ) then do what's after the if statement ,else do nothing

Question Answered as of 3 Years Ago by JasonHippy and alaa sam
You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: