Skip to content

Commit

Permalink
Fixed shell bug.. AGAIN!
Browse files Browse the repository at this point in the history
  • Loading branch information
rice7th authored Mar 4, 2022
1 parent 6358143 commit a0c1823
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions src/swef
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,20 @@ local function distro()
return distro
end

local function shell()
local is_the_global_variable_set = os.getenv("SHELL")
if not is_the_global_variable_set then
return "sh"
elseif exists("/usr/bin/basename") then
return opencmd("basename $SHELL")
else
return "sh"
end
end
local function fetch()
local os_type = os_family()
if os_type == "unix-like" then
if isdir("/rc") and isdir("/bin/ape") and exists("/bin/rc") then -- Is Plan9?
if isdir("/rc") and isdir("/bin/ape") and exists("/bin/ape/uname") then -- Is Plan9?
kernel = opencmd("/bin/ape/uname")
local fetch = {
os = 'Plan9',
Expand All @@ -240,7 +250,7 @@ local function fetch()
os = "Android",
wm = "AndroidWM",
kn = kern .. kern_release,
sh = opencmd("basename $SHELL")
sh = shell()
}
return fetch

Expand All @@ -249,7 +259,7 @@ local function fetch()
os = distro(),
wm = linux_bsd_wm(),
kn = kern .. " " .. kern_release,
sh = opencmd("basename $SHELL")
sh = shell()
}
return fetch
end
Expand All @@ -259,7 +269,7 @@ local function fetch()
os = "Mac Os",
wm = macos_wm(),
kn = kern .. " " .. kern_release,
sh = opencmd("basename $SHELL")
sh = shell()
}
return fetch

Expand All @@ -268,15 +278,15 @@ local function fetch()
os = "Windows (mingw)",
wm = windows_wm(),
kn = "mingw64",
sh = opencmd("basename $SHELL")
sh = shell()
}
return fetch
elseif kern:lower():find("bsd") then -- BSDs (FreeBSD, OpenBSD, NetBSD etc...). They work similarly to Linux
local fetch = {
os = os_name,
wm = linux_bsd_wm(),
kn = kern .. kern_release,
sh = opencmd("basename $SHELL")
sh = shell()
}
return fetch

Expand All @@ -285,7 +295,7 @@ local function fetch()
os = "Haiku",
wm = "default",
kn = kern .. kern_release,
sh = opencmd("basename $SHELL")
sh = shell()
}
return fetch
else
Expand Down Expand Up @@ -322,9 +332,7 @@ end


--[[ ===============
Ascii art time!
=============== ]]

local function ascii(info)
Expand Down

0 comments on commit a0c1823

Please sign in to comment.