2009-10-25から1日間の記事一覧

ファイルのiノード番号を調べる

ls -i の出力を加工する #!/bin/sh #file_inode.sh set -- `ls -i -d "$1"` echo "$1" $ ./file_inode.sh 1.text 1407374883568432

ファイルのアクセス権を調べる

#!/bin/sh #fileperm.sh [ -r "$1" ] && rp="readable" || rp="not readable" [ -w "$1" ] && wp="writable" || wp="not writable" [ -x "$1" ] && xp="executable" || xp="not executable" echo "$1 is $rp, $wp and $xp." $ ./fileperm.sh 1.text 1.text i…

ファイルの所有者を調べる

ls -l の出力を加工する #!/bin/sh #fileowner.sh if [ $# -ne 2 ]; then echo "Usage: fileowner.sh -u|-g filename" exit 1 fi case "$1" in "-u" ) show="user" ;; "-g" ) show="group" ;; * ) echo "$1: unknown option" exit 1 esac set -- `ls -l -d "…