mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37: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 {
|
||||
use std::path;
|
||||
use std::path::Path;
|
||||
match env::var("SHELL") {
|
||||
Ok(ref s) if !s.is_empty() => {
|
||||
if let Some(last) = s.rsplit(path::MAIN_SEPARATOR).next() {
|
||||
if last == "csh" || last == "tcsh" {
|
||||
let shell_path: &Path = s.as_ref();
|
||||
if let Some(name) = shell_path.file_name() {
|
||||
if name == "csh" || name == "tcsh" {
|
||||
OutputFmt::CShell
|
||||
} else {
|
||||
OutputFmt::Shell
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue