1

I made a script for checking the presence of *.m3u8 files from .csv file.

If the link is absent the *.m3u8 file is not downloaded.

How to do:

  1. If the file download errors out, create an empty file with name - "file"+"fake".m3u8

for example:

wget http://ex.ua/files/heroes.m3u8` 

this url is absent, so create file - heroesfake.m3u8

Zanna
  • 70,465
Oleksii
  • 353
  • 3
  • 14
  • What is the question? – mook765 Oct 16 '16 at 06:07
  • @Oleksii You said, "If the link is absent..." Is that to say that you would prefer the "fake" file only be created when the download fails with a "404 not found" error? (This is not the only way a download could fail.) – Eliah Kagan Feb 03 '17 at 10:39

1 Answers1

1

Have a look at How to check if a command succeeded?

For example:

#! /bin/bash
#
wget http://ex.ua/files/heroes.m3u8
if [ $? -ne 0 ]; then
    touch heroes-fake.m3u8
fi
Rmano
  • 31,947