you can use awk
and print
for use in this case or other cases , it's very simple and usefully .
on this case you can do bellow step :
1 = open ~/.bashrc and add bellow command end of this file
alias issymlink="sh /bin/issymlink.sh $1"
2 = create a file with bellow content in /bin/issymlink.sh
#!/bin/bash
path=$1
type=`stat $1 | awk 'FNR == 2 {print $8;}'`
if [ $type != "symbolic" ]
then
echo The path $1 is absolute and type of this path is $type
else
echo The path $1 is symlinks.
fi
3 - logout and login or type su
in terminal and enter
finally you can type issymlink PATH/TO/FILE/OR/DIRECTORY
in terminal and enter to check type of file
example usage and output :
issymlink /lib
The path /lib is absolute and type of this path is directory
issymlink /etc/nginx/sites-enabled/default
The path /etc/nginx/sites-enabled/default is symlinks.