Skip to content

Commit

Permalink
lsb_release
Browse files Browse the repository at this point in the history
  • Loading branch information
alexmyczko authored Oct 23, 2024
1 parent 94fd0d2 commit 253675d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ruptime
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ if [ "${1}x" = "-ux" ]; then
case "$(uname -s)" in
Linux|GNU/kFreeBSD)
s=$(echo $(lsb_release -a 2>/dev/null | grep -v ^LSB | grep -v ^Desc | awk '{print $NF}'))
# getting rid of lsb_release
# if /etc/system-release exists take it
# if /etc/os-release exists: cat /etc/os-release | (source /etc/os-release; echo $NAME $VERSION_ID)
;;
Darwin)
s=$(echo $(sw_vers 2>/dev/null | awk -v OFS="" '{$1=""}{print}'))
Expand Down

5 comments on commit 253675d

@crpb
Copy link

@crpb crpb commented on 253675d Oct 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test -e /etc/os-release && source /etc/os-release
test -e /etc/system-release && source /etc/system-release

@alexmyczko
Copy link
Owner Author

@alexmyczko alexmyczko commented on 253675d Oct 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

system-release is not sourcable

@crpb
Copy link

@crpb crpb commented on 253675d Oct 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe on crapOS?

cb@asterix ~crpb/ruptime (git)-[opensslopts] % secbash
Running as unit: run-u303861.service
Press ^] three times within 1s to disconnect TTY.
bash-5.2$ env
PWD=/
LOGNAME=run-u303861
SYSTEMD_EXEC_PID=3197647
LANG=en_US.UTF-8
INVOCATION_ID=c6be44884472423e922208df8bc3e0b0
TERM=screen-256color
USER=run-u303861
SHLVL=1
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
_=/usr/bin/env
bash-5.2$ source /etc/os-release
bash-5.2$ echo $VERSION_ID
12
bash-5.2$ echo $VERSION
$VERSION           $VERSION_CODENAME  $VERSION_ID
bash-5.2$ echo $VERSION_CODENAME
bookworm
bash-5.2$ echo $PRETTY_NAME
Debian GNU/Linux 12 (bookworm)
bash-5.2$
exit

@alexmyczko
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the crapOS being RHEL very old :)

@crpb
Copy link

@crpb crpb commented on 253675d Oct 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... && . /etc/os-release

Please sign in to comment.