I use a modifies list command as alias (in KSH):
alias ltf='ls -lrt -d -1 $PWD/*'
So the command ltf
displays something like this:
-rw-r--r-- 1 myuser mygroup 0 Apr 18 12:00 /usr/test.txt
-rw-r--r-- 1 myuser mygroup 0 Apr 18 12:00 /usr/test.log
Now I want to use wildcards. But using ltf *.log
does not work.
What is the best way to achieve that?
Update: I want to specify my question because the answers does not solve my problem so far: the command ls -lrt -d -1 $PWD/*
executes a list command with some options AND it displays the full path, which is an important point for me.
Unfortunately the alias approach does not allow wildcard parameters. My goal is to make this possible. Probably it is the best way to create the command as a function. This is mentioned in the answers, but it does not work yet (see comments).
Any ideas?
[[ -z "$1" ]] && ls -lrtd1 "$PWD/*" || ls -lrtd1 "$1"
– Scripture