help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to compgen only files?


From: Peng Yu
Subject: How to compgen only files?
Date: Thu, 28 Jan 2021 23:42:48 -0600

Hi,

I see that `compgen -f` shows not only files but also directories and
fifo. Is there a way to just show files? Thanks.

$ tmpdir=$(mktemp -d)
$ touch "$tmpdir/file"
$ mkdir -p "$tmpdir/dir"
$ mkfifo "$tmpdir/fifo"
$ compgen -f "$tmpdir/"
/tmp/mktemp/tmp.VKUlwuaRfB/file
/tmp/mktemp/tmp.VKUlwuaRfB/dir
/tmp/mktemp/tmp.VKUlwuaRfB/fifo

-- 
Regards,
Peng



reply via email to

[Prev in Thread] Current Thread [Next in Thread]