Re: Is there a better way

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Adrian C. said:
>
> Or so, if you dont trust the "&&"
>
> #!/bin/bash
> for pkgurl in $(cat pkg-url-list.txt); do
> wget $pkgurl ;
> code=$?
> echo $code
> if [ $code != 0 ]
>   then
>    echo "Couldn't retrieve file :("
> ###break loop instead of exit 1
> break
> fi
>
> done

Also, may want to add the variable to your error message so you know which
file it couldn't get:
    echo "Couldn't retrieve file: $pkgurl :("

--
Scott

-
: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Newbie]     [Audio]     [Hams]     [Kernel Newbies]     [Util Linux NG]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Device Drivers]     [Samba]     [Video 4 Linux]     [Git]     [Fedora Users]

  Powered by Linux