From 77834a64c2cd97be7da76d57b0015ebb0ccee456 Mon Sep 17 00:00:00 2001
From: Adar Nimrod <nimrod@shore.co.il>
Date: Tue, 5 Jul 2022 10:35:58 +0300
Subject: [PATCH] Shell function to retrieve the Podman container name from
 inside the container.

---
 .bashrc | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/.bashrc b/.bashrc
index 0492216..3d51f2a 100644
--- a/.bashrc
+++ b/.bashrc
@@ -192,6 +192,16 @@ ansible_all () {
     popd
 }
 
+container_name() {
+    if [ -f /run/.containerenv ]
+    then
+        # shellcheck disable=SC1091
+        ( . /run/.containerenv; echo "$name"; )
+    else
+        hostname -s
+    fi
+}
+
 ddg () {
     w3m "https://duckduckgo.com/lite/?q=$(echo "$@" | urlencode)"
 }
-- 
GitLab