Re: [PATCH] Ignore empty lines when grepping host's mirrorlist

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



On Sat, Sep 11, 2010 at 01:46:48AM +0300, Evangelos Foutras wrote:
> ---
>  mkarchroot |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/mkarchroot b/mkarchroot
> index fe436f7..5cb9a0f 100755
> --- a/mkarchroot
> +++ b/mkarchroot
> @@ -73,7 +73,7 @@ if [ -z "$cache_dir" ]; then
>  fi
>  
>  if [ -f /etc/pacman.d/mirrorlist ]; then
> -	host_mirror=$(grep -v '^#' -m1 /etc/pacman.d/mirrorlist | sed -E 's#/os/(i686|x86_64)#/os/\$arch#g')
> +	host_mirror=$(grep -E -v '^(#|$)' -m1 /etc/pacman.d/mirrorlist | sed -E 's#/os/(i686|x86_64)#/os/\$arch#g')
>  fi
>  if [ -z "${host_mirror}" ]; then
>  	host_mirror='Server = http://mirrors.kernel.org/archlinux/$repo/os/$arch'
> -- 
> 1.7.2.3
> 

Keep in mind this will still catch a line that only has spaces in it. I
would suggest using the pattern '^[\t ]*(#|$)' instead to avoid this.

d


[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux