{"id":1719,"date":"2011-04-17T13:13:36","date_gmt":"2011-04-17T07:43:36","guid":{"rendered":"http:\/\/sendyoursmiles.com\/articles\/shell-script-tutorial"},"modified":"2011-04-17T13:13:36","modified_gmt":"2011-04-17T07:43:36","slug":"shell-script-tutorial","status":"publish","type":"post","link":"https:\/\/erpschools.com\/erps\/articles\/shell-script-tutorial","title":{"rendered":"Shell Script Tutorial"},"content":{"rendered":"<p><span style=\"text-decoration: underline;\">Topics:<\/span><\/p>\n<ul>\n<li>Steps to Register Shell Script as a concurrent program<\/li>\n<li>Sample Shell Script to copy the file from source to destination<\/li>\n<li>Basic Shell Script Commands<\/li>\n<\/ul>\n<p>Steps to Register Shell Script as a concurrent program<\/p>\n<p>step 1:<br \/>\n=======<br \/>\nPlace the &lt;name&gt;.prog script under the bin directory for your\u00a0applications top directory.<\/p>\n<p>For example, call the script ERPS_DEMO.prog and place it under\u00a0$CUSTOM_TOP\/bin<\/p>\n<p>step 2:<br \/>\n=======<br \/>\nMake a symbolic link from your script to $FND_TOP\/bin\/fndcpesr<br \/>\nFor example, if the script is called ERPS_DEMO.prog use this:<\/p>\n<p>ln -s $FND_TOP\/bin\/fndcpesr ERPS_DEMO<\/p>\n<p>This link should be named the same as your script without the\u00a0.prog extension.<\/p>\n<p>Put the link for your script in the same directory where the\u00a0script is located.<\/p>\n<p>step 3:<br \/>\n=======<br \/>\nRegister the concurrent program, using an execution method of\u00a0&#8216;Host&#8217;. Use the name of your script without the .prog extension\u00a0as the name of the executable.<\/p>\n<p>For the example above:<br \/>\nUse ERPS_DEMO<\/p>\n<p>step 4:<br \/>\n=======<br \/>\nYour script will be passed at least 4 parameters, from $1 to $4.<\/p>\n<p>$1 = orauser\/pwd<br \/>\n$2 = userid(apps)<br \/>\n$3 = username,<br \/>\n$4 = request_id<\/p>\n<p>Any other parameters you define will be passed in as $5 and higher.<br \/>\nMake sure your script returns an exit status.<\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"text-decoration: underline;\">Shell Script to copy the file from source to destination<\/span><\/p>\n<p>#Note: If you see # in front of any line it means that it&#8217;s a comment line not the actual code<br \/>\n#** ********************************************************************<br \/>\n# Created By : Prudhvi A<br \/>\n# Creation Date : 19-FEB-2008<br \/>\n# Script Name : ERPSCHOOLS.prog<br \/>\n# Description : This Script accepts three parameters<br \/>\n# 1)Data File Name 2)Source Directory Path 3)Target Directory Path<br \/>\n# Then copy the file from source location to target location.<br \/>\n# If copy fails send the error status\/message to concurrent program so that user can see status.<br \/>\n#<br \/>\n#<br \/>\n# ========<br \/>\n# History<br \/>\n# ========<br \/>\n# Version 1 Prudhvi A 19-FEB-2008 Created for erpschools.com users<br \/>\n#<br \/>\n#** ********************************************************************<br \/>\n#Parameters from 1 to 4 i.e $1 $2 $3 $4 are standard parameters<br \/>\n# $1 : username\/password of the database<br \/>\n# $2 : userid<br \/>\n# $3 : USERNAME<br \/>\n# $4 : Concurrent Request ID<br \/>\nDataFileName=$5<br \/>\nSourceDirectory=$6<br \/>\nTargetDirectory=$7<br \/>\necho &#8220;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;&#8221;<br \/>\necho &#8220;Parameters received from concurrent program ..&#8221;<br \/>\necho &#8221; Time : &#8220;`date`<br \/>\necho &#8220;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;&#8221;<br \/>\necho &#8220;Arguments : &#8221;<br \/>\necho &#8221; Data File Name : &#8220;${DataFileName}<br \/>\necho &#8221; SourceDirectory : &#8220;${SourceDirectory}<br \/>\necho &#8221; TargetDirectory : &#8220;${TargetDirectory}<br \/>\necho &#8220;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;&#8221;<br \/>\necho &#8221; Copying the file from source directory to target directory&#8230;&#8221;<br \/>\ncp ${SourceDirectory}\/${DataFileName} ${TargetDirectory}<br \/>\nif [ $? -ne 0 ]<br \/>\n# the $? will contain the result of previously executed statement.<br \/>\n#It will be 0 if success and 1 if fail in many cases<br \/>\n# -ne represents not &#8220;equal to&#8221;<br \/>\nthen<br \/>\necho &#8220;Entered Exception&#8221;<br \/>\nexit 1<br \/>\n# exit 1 represents concurrent program status. 1 for error, 2 for warning 0 for success<br \/>\nelse<br \/>\necho &#8220;File Successfully copied from source to destination&#8221;<br \/>\nexit 0<br \/>\nfi<br \/>\necho &#8220;****************************************************************&#8221;<\/p>\n<p>Basic Shell Script Commands<\/p>\n<p># Create Directory<br \/>\nmkdir &lt;dirname&gt;<br \/>\n# Remove Directory<br \/>\nrmdir &lt;dirname&gt;<br \/>\n#remove folder with files<br \/>\nrm -r -f &lt;dirname&gt;<br \/>\n# Change Directory<br \/>\ncd &lt;newpath&gt;<br \/>\n# Create new file<br \/>\nvi &lt;newfile.ext&gt;<br \/>\n#insert data into file<br \/>\nvi &lt;openfilename.ext&gt;<br \/>\nesc i &lt;make changes&gt;<br \/>\n#Save file<br \/>\nesc :wq enter<br \/>\n# exit without saving changes<br \/>\nesc :q! enter<br \/>\n# open existing file<br \/>\nvi &lt;existingfilename.ext&gt;<br \/>\n#remove file<br \/>\nrm &lt;filename.ext&gt;<br \/>\n# copy file with same name<br \/>\ncp &lt;sourcedir&gt;\/&lt;sourcefilename.ext&gt; &lt;destinationdir&gt;<br \/>\n# copy file with new name<br \/>\ncp &lt;sourcedir&gt;\/&lt;sourcefilename.ext&gt; &lt;destinationdir&gt;\/&lt;newfilename.ext&gt;<br \/>\n# Move file with same name<br \/>\nmv &lt;sourcedir&gt;\/&lt;sourcefilename.ext&gt; &lt;destinationdir&gt;<br \/>\n# move file with data appended to filename in the front<br \/>\nmv &lt;sourcedir&gt;\/&lt;sourcefilename.ext&gt; &lt;destinationdir&gt;\/`date+%H%M%d%m%y`&lt;filename.ext&gt;<br \/>\n#print line<br \/>\necho &#8220;your text here to print&#8221;<br \/>\n#print date<br \/>\necho `date`<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Topics: Steps to Register Shell Script as a concurrent program Sample Shell Script to copy the file from source to destination Basic Shell Script Commands Steps to Register Shell Script as a concurrent program step 1: ======= Place the &lt;name&gt;.prog script under the bin directory for your\u00a0applications top directory. For example, call the script ERPS_DEMO.prog [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[88,3,89,11],"tags":[],"class_list":["post-1719","post","type-post","status-publish","format-standard","hentry","category-apps-beginners","category-articles","category-shell-script","category-tools"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v23.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Oracle Shell script tutorial<\/title>\n<meta name=\"description\" content=\"Steps to Register Shell Script as a concurrent program Sample Shell Script to copy the file from source to destination Basic Shell Script Commands\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/erpschools.com\/erps\/articles\/shell-script-tutorial\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Prudhvi\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/erpschools.com\/erps\/articles\/shell-script-tutorial#article\",\"isPartOf\":{\"@id\":\"https:\/\/erpschools.com\/erps\/articles\/shell-script-tutorial\"},\"author\":{\"name\":\"Prudhvi\",\"@id\":\"https:\/\/erpschools.com\/erps\/#\/schema\/person\/dbed9bb7fb66aa7a700fc565da024512\"},\"headline\":\"Shell Script Tutorial\",\"datePublished\":\"2011-04-17T07:43:36+00:00\",\"dateModified\":\"2011-04-17T07:43:36+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/erpschools.com\/erps\/articles\/shell-script-tutorial\"},\"wordCount\":592,\"commentCount\":7,\"publisher\":{\"@id\":\"https:\/\/erpschools.com\/erps\/#organization\"},\"articleSection\":[\"Apps Beginners\",\"Articles\",\"Shell Script\",\"Tools\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/erpschools.com\/erps\/articles\/shell-script-tutorial#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/erpschools.com\/erps\/articles\/shell-script-tutorial\",\"url\":\"https:\/\/erpschools.com\/erps\/articles\/shell-script-tutorial\",\"name\":\"Oracle Shell script tutorial\",\"isPartOf\":{\"@id\":\"https:\/\/erpschools.com\/erps\/#website\"},\"datePublished\":\"2011-04-17T07:43:36+00:00\",\"dateModified\":\"2011-04-17T07:43:36+00:00\",\"description\":\"Steps to Register Shell Script as a concurrent program Sample Shell Script to copy the file from source to destination Basic Shell Script Commands\",\"breadcrumb\":{\"@id\":\"https:\/\/erpschools.com\/erps\/articles\/shell-script-tutorial#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/erpschools.com\/erps\/articles\/shell-script-tutorial\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/erpschools.com\/erps\/articles\/shell-script-tutorial#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/erpschools.com\/erps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Shell Script Tutorial\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/erpschools.com\/erps\/#website\",\"url\":\"https:\/\/erpschools.com\/erps\/\",\"name\":\"erpSchools\",\"description\":\"Oracle Apps\",\"publisher\":{\"@id\":\"https:\/\/erpschools.com\/erps\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/erpschools.com\/erps\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/erpschools.com\/erps\/#organization\",\"name\":\"erpSchools\",\"url\":\"https:\/\/erpschools.com\/erps\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/erpschools.com\/erps\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/erpschools.com\/erps\/wp-content\/uploads\/img\/erps_logo7.png\",\"contentUrl\":\"https:\/\/erpschools.com\/erps\/wp-content\/uploads\/img\/erps_logo7.png\",\"width\":250,\"height\":60,\"caption\":\"erpSchools\"},\"image\":{\"@id\":\"https:\/\/erpschools.com\/erps\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"http:\/\/facebook.com\/erpschools\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/erpschools.com\/erps\/#\/schema\/person\/dbed9bb7fb66aa7a700fc565da024512\",\"name\":\"Prudhvi\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/erpschools.com\/erps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/488cec3605845b95cb20e60c67a8f5c7e74b65a305525c8006315d524f120db9?s=96&d=blank&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/488cec3605845b95cb20e60c67a8f5c7e74b65a305525c8006315d524f120db9?s=96&d=blank&r=g\",\"caption\":\"Prudhvi\"},\"sameAs\":[\"http:\/\/www.erpschools.com\"],\"url\":\"https:\/\/erpschools.com\/erps\/author\/prudhvi\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Oracle Shell script tutorial","description":"Steps to Register Shell Script as a concurrent program Sample Shell Script to copy the file from source to destination Basic Shell Script Commands","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/erpschools.com\/erps\/articles\/shell-script-tutorial","twitter_misc":{"Written by":"Prudhvi","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/erpschools.com\/erps\/articles\/shell-script-tutorial#article","isPartOf":{"@id":"https:\/\/erpschools.com\/erps\/articles\/shell-script-tutorial"},"author":{"name":"Prudhvi","@id":"https:\/\/erpschools.com\/erps\/#\/schema\/person\/dbed9bb7fb66aa7a700fc565da024512"},"headline":"Shell Script Tutorial","datePublished":"2011-04-17T07:43:36+00:00","dateModified":"2011-04-17T07:43:36+00:00","mainEntityOfPage":{"@id":"https:\/\/erpschools.com\/erps\/articles\/shell-script-tutorial"},"wordCount":592,"commentCount":7,"publisher":{"@id":"https:\/\/erpschools.com\/erps\/#organization"},"articleSection":["Apps Beginners","Articles","Shell Script","Tools"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/erpschools.com\/erps\/articles\/shell-script-tutorial#respond"]}]},{"@type":"WebPage","@id":"https:\/\/erpschools.com\/erps\/articles\/shell-script-tutorial","url":"https:\/\/erpschools.com\/erps\/articles\/shell-script-tutorial","name":"Oracle Shell script tutorial","isPartOf":{"@id":"https:\/\/erpschools.com\/erps\/#website"},"datePublished":"2011-04-17T07:43:36+00:00","dateModified":"2011-04-17T07:43:36+00:00","description":"Steps to Register Shell Script as a concurrent program Sample Shell Script to copy the file from source to destination Basic Shell Script Commands","breadcrumb":{"@id":"https:\/\/erpschools.com\/erps\/articles\/shell-script-tutorial#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/erpschools.com\/erps\/articles\/shell-script-tutorial"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/erpschools.com\/erps\/articles\/shell-script-tutorial#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/erpschools.com\/erps"},{"@type":"ListItem","position":2,"name":"Shell Script Tutorial"}]},{"@type":"WebSite","@id":"https:\/\/erpschools.com\/erps\/#website","url":"https:\/\/erpschools.com\/erps\/","name":"erpSchools","description":"Oracle Apps","publisher":{"@id":"https:\/\/erpschools.com\/erps\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/erpschools.com\/erps\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/erpschools.com\/erps\/#organization","name":"erpSchools","url":"https:\/\/erpschools.com\/erps\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/erpschools.com\/erps\/#\/schema\/logo\/image\/","url":"https:\/\/erpschools.com\/erps\/wp-content\/uploads\/img\/erps_logo7.png","contentUrl":"https:\/\/erpschools.com\/erps\/wp-content\/uploads\/img\/erps_logo7.png","width":250,"height":60,"caption":"erpSchools"},"image":{"@id":"https:\/\/erpschools.com\/erps\/#\/schema\/logo\/image\/"},"sameAs":["http:\/\/facebook.com\/erpschools"]},{"@type":"Person","@id":"https:\/\/erpschools.com\/erps\/#\/schema\/person\/dbed9bb7fb66aa7a700fc565da024512","name":"Prudhvi","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/erpschools.com\/erps\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/488cec3605845b95cb20e60c67a8f5c7e74b65a305525c8006315d524f120db9?s=96&d=blank&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/488cec3605845b95cb20e60c67a8f5c7e74b65a305525c8006315d524f120db9?s=96&d=blank&r=g","caption":"Prudhvi"},"sameAs":["http:\/\/www.erpschools.com"],"url":"https:\/\/erpschools.com\/erps\/author\/prudhvi"}]}},"_links":{"self":[{"href":"https:\/\/erpschools.com\/erps\/wp-json\/wp\/v2\/posts\/1719","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/erpschools.com\/erps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/erpschools.com\/erps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/erpschools.com\/erps\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/erpschools.com\/erps\/wp-json\/wp\/v2\/comments?post=1719"}],"version-history":[{"count":0,"href":"https:\/\/erpschools.com\/erps\/wp-json\/wp\/v2\/posts\/1719\/revisions"}],"wp:attachment":[{"href":"https:\/\/erpschools.com\/erps\/wp-json\/wp\/v2\/media?parent=1719"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/erpschools.com\/erps\/wp-json\/wp\/v2\/categories?post=1719"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/erpschools.com\/erps\/wp-json\/wp\/v2\/tags?post=1719"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}