{"id":10,"date":"2009-08-08T14:39:56","date_gmt":"2009-08-08T14:39:56","guid":{"rendered":"http:\/\/www.adriangrigoras.com\/blog\/?p=10"},"modified":"2009-08-08T14:39:56","modified_gmt":"2009-08-08T14:39:56","slug":"read-command-line-parameters-with-perl-and-bash","status":"publish","type":"post","link":"https:\/\/adriangrigoras.com\/blog\/read-command-line-parameters-with-perl-and-bash\/","title":{"rendered":"Read command line parameters with Perl and Bash"},"content":{"rendered":"<p>Today I was try to pass some paramters to my CGI script directly from command line. I have a bash file which execute some perl commands and I need it to be configurable.<\/p>\n<p>Bellow are two examples of how to read command line parameters, first is with Bash and second one is with Perl:<\/p>\n<p>1. Read command line parameters with Bash<\/p>\n<address>#!\/bin\/bash<br \/>\necho &#8220;$# parameters&#8221;<br \/>\necho &#8220;$@&#8221;;<br \/>\n<\/address>\n<p>2. Read command line parameters with Perl<\/p>\n<address>#!\/usr\/bin\/perl<\/address>\n<address>foreach $argnum (0 .. $#ARGV) {<\/address>\n<address> print &#8220;$ARGV[$argnum]n&#8221;;<\/address>\n<address>}<\/address>\n<pre>\nThat's it!<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Today I was try to pass some paramters to my CGI script directly from command line. I have a bash file which execute some perl commands and I need it to be configurable. Bellow are two examples of how to read command line parameters, first is with Bash and second one is with Perl: 1.\u2026 <span class=\"read-more\"><a href=\"https:\/\/adriangrigoras.com\/blog\/read-command-line-parameters-with-perl-and-bash\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11,14],"tags":[],"class_list":["post-10","post","type-post","status-publish","format-standard","hentry","category-linux","category-perl"],"_links":{"self":[{"href":"https:\/\/adriangrigoras.com\/blog\/wp-json\/wp\/v2\/posts\/10","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/adriangrigoras.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/adriangrigoras.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/adriangrigoras.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/adriangrigoras.com\/blog\/wp-json\/wp\/v2\/comments?post=10"}],"version-history":[{"count":0,"href":"https:\/\/adriangrigoras.com\/blog\/wp-json\/wp\/v2\/posts\/10\/revisions"}],"wp:attachment":[{"href":"https:\/\/adriangrigoras.com\/blog\/wp-json\/wp\/v2\/media?parent=10"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/adriangrigoras.com\/blog\/wp-json\/wp\/v2\/categories?post=10"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/adriangrigoras.com\/blog\/wp-json\/wp\/v2\/tags?post=10"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}