Hi,
As part of “debug” part of my application (running within a Snap), I would like to be able to display version of Snap package. Is this information stored somewhere inside the container?
Thanks!
Hi,
As part of “debug” part of my application (running within a Snap), I would like to be able to display version of Snap package. Is this information stored somewhere inside the container?
Thanks!
yes, it is in an environment variable:
$ snap run --shell htop
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.
$ echo $SNAP_VERSION
3.0.5
$ exit
$ snap info htop | grep ^installed
installed: 3.0.5 (2185) 17MB -
$
Just to add to @ogra’s excellent answer, here are the docs about those environment variables.