ファイルが実体ファイルなのか、シンボリックリンクなのかを確認する方法を以下に記します。
尚、利用したシェルは bash になります。
以下にサンプルスクリプトを記します。
動作内容は、foo.txtファイルを作成し、bar.txtシンボリックリンクを作成したあと、-Lの使用例を記しています。
処理終了後、作成したファイルは削除しています。
#!/bin/bash echo "test" > foo.txt if [ ! -L foo.txt ]; then echo foo.txt is not symbolic link else echo foo.txt is symbolic link fi ln -s foo.txt bar.txt if [ -L bar.txt ]; then echo bar.txt is symbolic link else echo foo.txt is not symbolic link fi rm bar.txt foo.txt
$ chmod +x sample-01.sh $ ./sample-01.sh foo.txt is not symbolic link bar.txt is symbolic link