3 added 3 characters in body
source | link

Using bash and its GLOBIGNORE shell variable, together with macOS's basename:

$ mkdir dir
$ touch dir/file{1,2}{,~}
$ ls -R
dir

./dir:
file1   file1~  file2   file2~
$ GLOBIGNORE=*~
$ ls -d dir/*
dir/file1       dir/file2
$ basename -a dir/*
file1
file2

Setting GLOBIGNORE to a list of :-delimited patterns will make filename completion ignore those patterns.

The basename utility in macOS accepts more than one pathname if you use its -a option, and will return a list consisting of only the filename portions of those pathnames.

Instead of using GLOBIGNORE (which provides a more generic way to ignore certain filename pattern expansions) you could obviously use your pattern *[!~] (note that ! negates a character class in the shell, while ^ negates a character class in regular expressions):

unset GLOBIGNORE
basename -a dir/*[!~]

... or, you could just install GNU coreutils from Homebrew and use gls -B as you may be used to on Linux systems.

Using bash and its GLOBIGNORE shell variable, together with macOS's basename:

$ mkdir dir
$ touch dir/file{1,2}{,~}
$ ls -R
dir

./dir:
file1   file1~  file2   file2~
$ GLOBIGNORE=*~
$ ls dir/*
dir/file1       dir/file2
$ basename -a dir/*
file1
file2

Setting GLOBIGNORE to a list of :-delimited patterns will make filename completion ignore those patterns.

The basename utility in macOS accepts more than one pathname if you use its -a option, and will return a list consisting of only the filename portions of those pathnames.

Instead of using GLOBIGNORE (which provides a more generic way to ignore certain filename pattern expansions) you could obviously use your pattern *[!~] (note that ! negates a character class in the shell, while ^ negates a character class in regular expressions):

unset GLOBIGNORE
basename -a dir/*[!~]

... or, you could just install GNU coreutils from Homebrew and use gls -B as you may be used to on Linux systems.

Using bash and its GLOBIGNORE shell variable, together with macOS's basename:

$ mkdir dir
$ touch dir/file{1,2}{,~}
$ ls -R
dir

./dir:
file1   file1~  file2   file2~
$ GLOBIGNORE=*~
$ ls -d dir/*
dir/file1       dir/file2
$ basename -a dir/*
file1
file2

Setting GLOBIGNORE to a list of :-delimited patterns will make filename completion ignore those patterns.

The basename utility in macOS accepts more than one pathname if you use its -a option, and will return a list consisting of only the filename portions of those pathnames.

Instead of using GLOBIGNORE (which provides a more generic way to ignore certain filename pattern expansions) you could obviously use your pattern *[!~] (note that ! negates a character class in the shell, while ^ negates a character class in regular expressions):

unset GLOBIGNORE
basename -a dir/*[!~]

... or, you could just install GNU coreutils from Homebrew and use gls -B as you may be used to on Linux systems.

2 added 190 characters in body
source | link

Using bash and its GLOBIGNORE shell variable, together with macOS's basename:

$ mkdir dir
$ touch dir/file{1,2}{,~}
$ ls -R
dir

./dir:
file1   file1~  file2   file2~
$ GLOBIGNORE=*~
$ ls dir/*
dir/file1       dir/file2
$ basename -a dir/*
file1
file2

Setting GLOBIGNORE to a list of :-delimited patterns will make filename completion ignore those patterns.

The basename utility in macOS accepts more than one pathname if you use its -a option, and will return a list consisting of only the filename portions of those pathnames.

Instead of using GLOBIGNORE (which provides a more generic way to ignore certain filename pattern expansions) you could obviously use your pattern *[!~] (note that ! negates a character class in the shell, while ^ negates a character class in regular expressions):

unset GLOBIGNORE
basename -a dir/*[!~]

... or, you could just install GNU coreutils from Homebrew and use gls -B as you may be used to on Linux systems.

Using bash and its GLOBIGNORE shell variable, together with macOS's basename:

$ mkdir dir
$ touch dir/file{1,2}{,~}
$ ls -R
dir

./dir:
file1   file1~  file2   file2~
$ GLOBIGNORE=*~
$ ls dir/*
dir/file1       dir/file2
$ basename -a dir/*
file1
file2

Setting GLOBIGNORE to a list of :-delimited patterns will make filename completion ignore those patterns.

The basename utility in macOS accepts more than one pathname if you use its -a option, and will return a list consisting of only the filename portions of those pathnames.

Using bash and its GLOBIGNORE shell variable, together with macOS's basename:

$ mkdir dir
$ touch dir/file{1,2}{,~}
$ ls -R
dir

./dir:
file1   file1~  file2   file2~
$ GLOBIGNORE=*~
$ ls dir/*
dir/file1       dir/file2
$ basename -a dir/*
file1
file2

Setting GLOBIGNORE to a list of :-delimited patterns will make filename completion ignore those patterns.

The basename utility in macOS accepts more than one pathname if you use its -a option, and will return a list consisting of only the filename portions of those pathnames.

Instead of using GLOBIGNORE (which provides a more generic way to ignore certain filename pattern expansions) you could obviously use your pattern *[!~] (note that ! negates a character class in the shell, while ^ negates a character class in regular expressions):

unset GLOBIGNORE
basename -a dir/*[!~]

... or, you could just install GNU coreutils from Homebrew and use gls -B as you may be used to on Linux systems.

1
source | link

Using bash and its GLOBIGNORE shell variable, together with macOS's basename:

$ mkdir dir
$ touch dir/file{1,2}{,~}
$ ls -R
dir

./dir:
file1   file1~  file2   file2~
$ GLOBIGNORE=*~
$ ls dir/*
dir/file1       dir/file2
$ basename -a dir/*
file1
file2

Setting GLOBIGNORE to a list of :-delimited patterns will make filename completion ignore those patterns.

The basename utility in macOS accepts more than one pathname if you use its -a option, and will return a list consisting of only the filename portions of those pathnames.