{"id":834,"date":"2018-08-17T19:14:22","date_gmt":"2018-08-17T16:14:22","guid":{"rendered":"http:\/\/leonidassavvides.com\/blog\/?p=834"},"modified":"2018-08-17T19:14:22","modified_gmt":"2018-08-17T16:14:22","slug":"run-differ-scripting-languages-program-files-from-one-shell-script","status":"publish","type":"post","link":"https:\/\/www.leonidassavvides.com\/blog\/2018\/08\/run-differ-scripting-languages-program-files-from-one-shell-script\/","title":{"rendered":"RUN DIFFER SCRIPTING LANGUAGES PROGRAM FILES FROM ONE SHELL SCRIPT"},"content":{"rendered":"<div style=\"margin-top: 0px; margin-bottom: 0px;\" class=\"sharethis-inline-share-buttons\" ><\/div><p style=\"text-align: center;\">Run py, sh, php, pl program files from a single shell script<\/p>\n<p style=\"text-align: center;\">================<\/p>\n<p>Tested in Cent OS 7.5 Linux<\/p>\n<p>Level Beginner &#8211; Internediate<\/p>\n<p><a href=\"https:\/\/s3-eu-west-1.amazonaws.com\/lse-blogs\/Scripts\/shell-script-call-py-sh-php-perl-scripts.zip\">Free Download ALL Script Files for this Post<\/a><\/p>\n<p>Here is the console from my Linux SSH Terminal (PuTTY Win 10):<\/p>\n<p>Please view my console below &#8211; and download zip files from my AWS S3 cloud storage link just above<\/p>\n<p>&nbsp;<\/p>\n<div class=\"aLF-aPX-aPk\">\n<div class=\"aLF-aPX-aPk-aMh aLF-aPX-Jq-aPn\" role=\"main\">\n<div class=\"aLF-aPX-bhI \">\n<div class=\"aLF-aPX-K0-Jw\">\n<div class=\"aLF-aPX-K0-aPH aLF-aPX-aPH\">\n<div class=\"aLF-aPX-K0\">\n<div class=\"aLF-aPX-K0-aOg aLF-aPX-Jq-aPn\">\n<div class=\"aLF-aPX-K0-P6 aLF-aPX-av4-aPV\">\n<div class=\"aLF-aPX-K0-Jz\" dir=\"ltr\" tabindex=\"0\" role=\"document\" aria-label=\"Displaying cmd-line.txt\">\n<pre class=\"aLF-aPX-K0-aPE\">Using username \"root\".\nAuthenticating with public key \"rsa-key-20170603\" from agent\nLast login: Thu Aug 16 20:40:43 2018 from pc7\n[root@server1 ~]# whereis php\nphp: \/usr\/bin\/php \/usr\/lib64\/php \/etc\/php.d \/etc\/php.ini \/usr\/share\/php \/usr\/share\/man\/man1\/php.1.gz\n[root@server1 ~]# whereis python\npython: \/usr\/bin\/python2.7 \/usr\/bin\/python \/usr\/lib\/python2.7 \/usr\/lib64\/python2.7 \/etc\/python \/usr\/include\/python2.7 \/usr\/share\/man\/man1\/python.1.gz\n[root@server1 ~]# whereis perl\nperl: \/usr\/bin\/perl \/usr\/share\/man\/man1\/perl.1.gz\n[root@server1 ~]# whereis bash\nbash: \/usr\/bin\/bash \/usr\/share\/man\/man1\/bash.1.gz\n[root@server1 ~]# \n[root@server1 ~]# mkdir blog\n[root@server1 ~]# cd blog\n[root@server1 blog]# vim script.sh\n[root@server1 blog]# chmod u+x script.sh\n[root@server1 blog]# cat script.sh\n#!\/usr\/bin\/bash\n# using the case command\n#\n\nread -p \"Please enter language: \" lang\n\ncase $lang in\n    py | python | Python)\n        \/usr\/bin\/python2.7 py.py;;\n    shell | sh)\n        \/usr\/bin\/bash shell.sh;;\n    perl | pl)\n        \/usr\/bin\/perl perl.pl;;\n    php)\n        \/usr\/bin\/php php.php;;\n    *)\n        echo \"sh, php, py or pl only, you entered \"$lang ;;\nesac\n\n# whereis bash\n# whereis python\n# whereis perl\n# whereis php\n\n\n\n[root@server1 blog]# vim php.php\n[root@server1 blog]# cat php.php\n&lt;?php\n\necho \"From PHP !\";\n\n?&gt;\n\n\n\n\n[root@server1 blog]# vim py.py\n[root@server1 blog]# cat py.py\n\n#!\/usr\/bin\/python2.7\n\nprint(\"From Python !\");\n\n\n[root@server1 blog]# vim shell.sh\n[root@server1 blog]# cat shell.sh\n#!\/usr\/bin\/bash\n\nprint(\"From shell script !\");\n\n\n[root@server1 blog]# vim perl.pl\n[root@server1 blog]# cat perl.pl\n#!\/usr\/bin\/perl\n\nprint(\"From Perl !\");\n\n\n[root@server1 blog]# .\/script.sh\nPlease enter language: php\nFrom PHP !\n\n\n\n[root@server1 blog]# .\/script.sh\nPlease enter language: py\nFrom Python !\n[root@server1 blog]# .\/script.sh\nPlease enter language: pl\nFrom Perl !\n[root@server1 blog]# vim shell.sh\n[root@server1 blog]# cat shell.sh\n#!\/usr\/bin\/bash\n\necho \"From shell script !\";\n\n\n[root@server1 blog]# .\/script.sh\nPlease enter language: sh\nFrom shell script !\n[root@server1 blog]# cat script.sh\n#!\/usr\/bin\/bash\n# using the case command\n#\n\nread -p \"Please enter language: \" lang\n\ncase $lang in\n    py | python | Python)\n        \/usr\/bin\/python2.7 py.py;;\n    shell | sh)\n        \/usr\/bin\/bash shell.sh;;\n    perl | pl)\n        \/usr\/bin\/perl perl.pl;;\n    php)\n        \/usr\/bin\/php php.php;;\n    *)\n        echo \"sh, php, py or pl only, you entered \"$lang ;;\nesac\n\n# whereis bash\n# whereis python\n# whereis perl\n# whereis php\n\n[root@server1 blog]#<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Run py, sh, php, pl program files from a single shell script ================ Tested in Cent OS 7.5 Linux Level Beginner &#8211; Internediate Free Download ALL Script Files for this Post Here is the console from my Linux SSH Terminal (PuTTY Win 10): Please view my console below &#8211; and download zip files from my &hellip; <a href=\"https:\/\/www.leonidassavvides.com\/blog\/2018\/08\/run-differ-scripting-languages-program-files-from-one-shell-script\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;RUN DIFFER SCRIPTING LANGUAGES PROGRAM FILES FROM ONE SHELL SCRIPT&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[43],"tags":[],"class_list":["post-834","post","type-post","status-publish","format-standard","hentry","category-tech"],"_links":{"self":[{"href":"https:\/\/www.leonidassavvides.com\/blog\/wp-json\/wp\/v2\/posts\/834","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.leonidassavvides.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.leonidassavvides.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.leonidassavvides.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.leonidassavvides.com\/blog\/wp-json\/wp\/v2\/comments?post=834"}],"version-history":[{"count":0,"href":"https:\/\/www.leonidassavvides.com\/blog\/wp-json\/wp\/v2\/posts\/834\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.leonidassavvides.com\/blog\/wp-json\/wp\/v2\/media?parent=834"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.leonidassavvides.com\/blog\/wp-json\/wp\/v2\/categories?post=834"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.leonidassavvides.com\/blog\/wp-json\/wp\/v2\/tags?post=834"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}