Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
checking link files
- X-seq: zsh-users 11683
- From: pol <linux_milano@xxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: checking link files
- Date: Sun, 29 Jul 2007 02:42:34 +0200
- Mail-copies-to: linux_milano@xxxxxxxx
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- Reply-to: linux_milano@xxxxxxxx
- Sender: news <news@xxxxxxxxxxxxx>
To tell real files from symbolic links, so as to separate the filename from
the path to be able to change to the actual file the link is pointing to,
i have put down the following script:
#!/bin/zsh
zmodload zsh/stat
inp=$1
if [ ! -h $1 ];then
echo $inp " is a real file"
fi
if [ -h $inp ]; then
echo $inp " is a symbolic link"
ffile="`stat +link $inp`"
fpath=$ffile:h
fname=$ffile:t
fi
Any suggestions to improve it will be welcome
thank you
Pol
Messages sorted by:
Reverse Date,
Date,
Thread,
Author