mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-29 03:57:44 +00:00
dircolors: extract shell name from $SHELL properly
This commit is contained in:
parent
2758455d73
commit
5dba86dfa2
1 changed files with 4 additions and 3 deletions
|
@ -36,11 +36,12 @@ pub enum OutputFmt {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn guess_syntax() -> OutputFmt {
|
pub fn guess_syntax() -> OutputFmt {
|
||||||
use std::path;
|
use std::path::Path;
|
||||||
match env::var("SHELL") {
|
match env::var("SHELL") {
|
||||||
Ok(ref s) if !s.is_empty() => {
|
Ok(ref s) if !s.is_empty() => {
|
||||||
if let Some(last) = s.rsplit(path::MAIN_SEPARATOR).next() {
|
let shell_path: &Path = s.as_ref();
|
||||||
if last == "csh" || last == "tcsh" {
|
if let Some(name) = shell_path.file_name() {
|
||||||
|
if name == "csh" || name == "tcsh" {
|
||||||
OutputFmt::CShell
|
OutputFmt::CShell
|
||||||
} else {
|
} else {
|
||||||
OutputFmt::Shell
|
OutputFmt::Shell
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue