What
Where
photosmarinavlad  

 

Didenko Family

© 2003-2023 Vlad Didenko, Marina Didenko

ALL RIGHTS RESERVED

The content rights are not available for sale or licensing. Any use of the content except by the website owners is prohibited, unless specified per-page otherwise, or agreed in writing otherwise.

This website is for personal photos and posts, for the benefit of family and friends. As such it has a minimal needed set of features. No backward compatibility with old browsers is considered.

Most photos are processed to match a personal perception at the time of capture, and some photos are processed creatively. No guarantees presented about photos resemblibling a reality in any sense. No guarantees presented that a technology, or a personal advice, or/and any information posted on the website is usefull or harmless for your environment.

Release query bash function

A twitter account @nixCraft posted one-liner to print your Linux distro version . As in many other cases the suggestion is to use external processes like awk. Because starting a new process is expensive, that makes the system to do unnesessary heavy lifting - and removes that “snappy” feeling from running your scripts.

Use an in-shell solution where possible, e.g:

function qrel {
  # qrel (query release)is a quick function to get
  # a value assosiated with a key in n /etc/os-release fie
  # ${1} is the expected key
  local IFS="="
  key=$(tr "[:lower:]" "[:upper:]" <<<${1})
  while read name value
  do
    value=${value#\"}
    value=${value%\"}
    [[ "${name}" == "${key}" ]] && {
      echo ${value}
      return
    }
  done </etc/os-release
}

Here are some examples:

$ qrel id
pop
$ qrel ID_LIKE
ubuntu debian
$ qrel version
20.10
$

But! What you you really should be doing is something like:

$ . /etc/os-release
$ echo $ID_LIKE
ubuntu debian
$

LOL

2021-05-11

 ∽   ⦾   ∽