{"id":3189,"date":"2011-12-09T01:28:50","date_gmt":"2011-12-09T07:28:50","guid":{"rendered":"http:\/\/humairahmed.com\/blog\/?p=3189"},"modified":"2011-12-09T01:35:54","modified_gmt":"2011-12-09T07:35:54","slug":"3189","status":"publish","type":"post","link":"https:\/\/humairahmed.com\/blog\/?p=3189","title":{"rendered":"Perl &#8211;  File-Test Operators"},"content":{"rendered":"<div class=\"twttr_buttons\"><div class=\"twttr_twitter\">\n\t\t\t\t\t<a href=\"http:\/\/twitter.com\/share?text=Perl+-++File-Test+Operators\" class=\"twitter-share-button\" data-via=\"\" data-hashtags=\"\"  data-size=\"default\" data-url=\"https:\/\/humairahmed.com\/blog\/?p=3189\"  data-related=\"\" target=\"_blank\">Tweet<\/a>\n\t\t\t\t<\/div><\/div><p>In Perl, file-test operators are useful for determining the status of a file. Some of the operators below refer to the &#8220;real user&#8221; which is the User ID specified at login rather than &#8220;effectve User ID&#8221; which refers to the User ID you are currently working under. The general syntax is -[file-test operator] [operand being tested]. <!--more--><\/p>\n<blockquote>\n<ul>\n<li>-b = is operand a block deice<\/li>\n<li>-c = is operand a character device<\/li>\n<li>-d = is operand a directory<\/li>\n<li>-e = does it exist<\/li>\n<li>-f = is operand an ordinary file<\/li>\n<li>-g = does operand have its setgid bit set<\/li>\n<li>-k = does operand have its &#8220;sticky bit&#8221; set<\/li>\n<li>-o = is operand owned by the user<\/li>\n<li>-p = is operand a named pipe<\/li>\n<li>-r = is operand a readable file<\/li>\n<li>-s = is operand a non-empty file<\/li>\n<li>-t = is operand a terminal<\/li>\n<li>-u = does operand have its setuid set<\/li>\n<li>-w = is operand a writable file<\/li>\n<li>-x = is operand an executable file<\/li>\n<li>-z = is operand an empty file<\/li>\n<li>-A = how long since operand has been accessed<\/li>\n<li>-B = is operand a binary file<\/li>\n<li>-C = how long since operand&#8217;s inode accessed<\/li>\n<li>-M = how long since operand modified<\/li>\n<li>-O = is operand owned by the &#8220;real user&#8221; (user who logged in) only<\/li>\n<li>-R = is operand readable by the &#8220;real user&#8221; (user who logged in) only<\/li>\n<li>-S = is operand a socket?<\/li>\n<li>-T = is operand a text file?<\/li>\n<li>-W = is operand writable by the &#8220;real user&#8221; only<\/li>\n<li>-X = is operand executable by the &#8220;real user&#8221; only<\/li>\n<\/ul>\n<\/blockquote>\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In Perl, file-test operators are useful for determining the status of a file. Some of the operators below refer to the &#8220;real user&#8221; which is the User ID specified at login rather than &#8220;effectve User ID&#8221; which refers to the &hellip; <a href=\"https:\/\/humairahmed.com\/blog\/?p=3189\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[382,5,3],"tags":[879,881,880,878,875,386,877,882,876],"class_list":["post-3189","post","type-post","status-publish","format-standard","hentry","category-perl","category-programming","category-technology","tag-check-file-status","tag-check-if-file-exists","tag-check-if-file-is-a-directory","tag-file-status","tag-file-test-operators","tag-perl-2","tag-perl-check-file-status","tag-perl-file-test-operator","tag-perl-file-test-operators"],"_links":{"self":[{"href":"https:\/\/humairahmed.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3189","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/humairahmed.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/humairahmed.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/humairahmed.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/humairahmed.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3189"}],"version-history":[{"count":19,"href":"https:\/\/humairahmed.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3189\/revisions"}],"predecessor-version":[{"id":3208,"href":"https:\/\/humairahmed.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3189\/revisions\/3208"}],"wp:attachment":[{"href":"https:\/\/humairahmed.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3189"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/humairahmed.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3189"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/humairahmed.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3189"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}