{"id":3297,"date":"2014-07-06T10:57:04","date_gmt":"2014-07-06T02:57:04","guid":{"rendered":"http:\/\/rmohan.com\/?p=3297"},"modified":"2014-07-06T10:57:04","modified_gmt":"2014-07-06T02:57:04","slug":"shell-to-find-directory-and-execute","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=3297","title":{"rendered":"Shell to find directory and execute"},"content":{"rendered":"<pre class=\"bbcodeblock\" dir=\"ltr\" style=\"margin: 0px -99999px 0px 0px; padding: 3px; border: 1px inset currentColor; width: 1439.6px; height: 402px; text-align: left; color: #000000; text-transform: none; line-height: normal; text-indent: 0px; letter-spacing: normal; overflow: auto; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; word-spacing: 0px; background-color: #e6e6e6; -webkit-text-stroke-width: 0px;\">#!\/bin\/bash\r\nKNOWN_PATH=\"\/usr\/sbin \/sbin \/opt\/apache2\/bin \/usr\/local\/sbin\"\r\nHTTPD_DIR=\r\n\r\nfor path in $KNOWN_PATH; do\r\n    echo \"trying $path\/httpd...\"\r\n    if `ls $path\/httpd &gt; \/dev\/null 2&gt;&amp;1`; then\r\n        HTTPD_DIR=$path\r\n        break\r\n    fi\r\ndone\r\n\r\nif [ -z $HTTPD_DIR ]; then\r\n    echo \"httpd path not found, please enter the path to directory where httpd is\"\r\n    echo -n \"httpd path : \"\r\n    read HTTPD_DIR\r\nfi\r\nHTTPD=\"$HTTPD_DIR\/httpd\"\r\n\r\nif [ ! -x $HTTPD ]; then\r\n    echo \"httpd could not be found, exiting...\"\r\n    exit 1\r\nfi\r\n$HTTPD -V<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>#!\/bin\/bash KNOWN_PATH=&#8221;\/usr\/sbin \/sbin \/opt\/apache2\/bin \/usr\/local\/sbin&#8221; HTTPD_DIR= for path in $KNOWN_PATH; do echo &#8220;trying $path\/httpd&#8230;&#8221; if `ls $path\/httpd &gt; \/dev\/null 2&gt;&amp;1`; then HTTPD_DIR=$path break fi done if [ -z $HTTPD_DIR ]; then echo &#8220;httpd path not found, please enter the path to directory where httpd is&#8221; echo -n &#8220;httpd path : &#8221; read HTTPD_DIR fi HTTPD=&#8221;$HTTPD_DIR\/httpd&#8221; [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[47],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/3297"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3297"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/3297\/revisions"}],"predecessor-version":[{"id":3298,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/3297\/revisions\/3298"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3297"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3297"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3297"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}