{"id":19275,"date":"2020-07-10T14:19:15","date_gmt":"2020-07-10T21:19:15","guid":{"rendered":"https:\/\/careerkarma.com\/blog\/?p=19275"},"modified":"2023-12-01T03:53:29","modified_gmt":"2023-12-01T11:53:29","slug":"bash-function","status":"publish","type":"post","link":"https:\/\/careerkarma.com\/blog\/bash-function\/","title":{"rendered":"Bash Functions: A Guide"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">How to Write a Bash Function <\/h2>\n\n\n\n<p>A function is a block of code that performs a particular task. Once you have defined a function in a program, it can be reused as many times as you want.<br><\/p>\n\n\n\n<p>Functions are useful because they allow you to reuse code. This enhances the readability of a program. It also means that when you need to make a change to your code, you only need to make that change in one place: where your function is defined.<br><\/p>\n\n\n\n<p>In this guide, we\u2019re going to talk about what functions are, how they work, and how you can define a function in bash. Without further ado, let&#8217;s begin!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Defining a Bash Function<\/h2>\n\n\n\n<p>Let\u2019s start by creating a function that prints \u201cI like scones!\u201d to the console.<br><\/p>\n\n\n\n<p>Open up a new bash file and call it functions.sh. The first step is to define a function. We can do this by using the <code>function<\/code> keyword, followed by the name of the function, then followed by a set of curly braces ({}).<br><\/p>\n\n\n\n<p>Here is our simple bash function:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>function print_scones { };<\/pre><\/div>\n\n\n\n<p>This function currently does nothing. To make our function work, we\u2019ve got to add a statement into its body. The body refers to all of the comments inside a function. Here\u2019s our revised function:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>function print_scones {\n\techo \"I like scones!\";\n}<\/pre><\/div>\n\n\n\n<p>This code only defines our function. This means that if we run our program, nothing will happen. To see our function in action, we\u2019ve got to call our function by specifying its name:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>#!\/bin\/bash\nfunction print_scones {\n\techo \"I like scones!\";\n}\nprint_scones<\/pre><\/div>\n\n\n\n<p>Now, let\u2019s run our script by executing <code>bash functions.sh<\/code>:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>I like scones!<\/pre><\/div>\n\n\n\n<p>Our code returns the message that we stated inside our functions. First, our code defines a function called <code>print_scones<\/code>. Then, our code calls that function.&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Passing Arguments to a Function<\/h2>\n\n\n\n<p>Our first function did not accept any arguments. This means that we couldn\u2019t send any values from our main program into our function.<br><\/p>\n\n\n\n<p>You can send data into a function by specifying a set of arguments when you call a function. Consider the following example:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>#!\/bin\/bash\nfunction like_to_eat {\n\techo \"I like to eat $1.\"\n}\nlike_to_eat scones<\/pre><\/div>\n\n\n\n<p>In this code, we have declared a function called like_to_eat. This function is capable of accepting arguments. In bash, the arguments passed to a function are assigned the values $1, $2, $3, and so on, depending on how many arguments you specify.<br><\/p>\n\n\n\n<p>We have specified one argument, which contains the value of the food that we like to eat. To give this argument a value, we need to state it when we call our function:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>like_to_eat scones<\/pre><\/div>\n\n\n\n<p>Let\u2019s run our program:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>I like to eat scones.<\/pre><\/div>\n\n\n\n<p>Our program has substituted $1 for the argument value that we specified, \u201cscones\u201d.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Returning a Value<\/h2>\n\n\n\n<p>Bash functions cannot return values to the main program. This is unlike most other programming languages where a return statement sends a value back to the main program.<br><\/p>\n\n\n\n<p>Bash does have a <code>return<\/code> statement, but it is used to retrieve the status of a function.<\/p>\n\n\n\n<p>Consider this example:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>#!\/bin\/bash\nfunction like_to_eat {\n\techo \"I like to eat $1.\"\n\treturn 1\n}\nlike_to_eat scones\necho $?<\/pre><\/div>\n\n\n\n<p>Our code returns:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>I like to eat scones.\n1<\/pre><\/div>\n\n\n\n<p>We have specified a return statement inside our function. This value is returned only if our function succeeds. Then, in our main program, we use the variable $? to retrieve the return status of the last function or command that was executed. This prints out 1 to the console, which is the return status from our function.<br><\/p>\n\n\n\n<p>In bash, a return value of 0 typically means that everything is fine. Values between 1 and 255 are used to indicate an error.<br><\/p>\n\n\n\n<p>There is a work-around if you want to return a value from a function. You can declare a global variable in your function whose value changes when the function executes:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>#!\/bin\/bash\nfunction like_to_eat {\n\tmessage=\"I like to eat $1.\"\n}\nlike_to_eat scones\necho $message<\/pre><\/div>\n\n\n\n<p>We have assigned a value to the \u201cmessage\u201d variable within our function. This value will only be assigned when our function is executed. In our main program, we print out the value of that message. Let\u2019s run our program and see what happens:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>I like to eat scones.<\/pre><\/div>\n\n\n\n<p>Our function works! Technically we\u2019re not returning any values in this example; we cannot return a text value with a return statement. Instead, we are setting a variable inside our function and referencing it inside our main program.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Local and Global Scope<\/h2>\n\n\n\n<p>When you\u2019re working with functions, variables can have two scopes: local and global.<br><\/p>\n\n\n\n<p>A global variable is a variable that is visible anywhere in a program. By default, variables are global. Within a function, you can declare a local variable. This is a variable that is only accessible inside our function.<br><\/p>\n\n\n\n<p>To define a local variable, we need to use the local keyword:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>function print_scones {\nlocal message=\"I like scones.\"\n|<\/pre><\/div>\n\n\n\n<p>This code assigns the value \u201cI like scones.\u201d to the variable \u201cmessage\u201d. This variable is only accessible within the <code>print_scones<\/code> function.<br><\/p>\n\n\n\n<p>Create a file called scope.sh and paste in the following code:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>#!\/bin\/bash\nfunction like_to_eat {\n\tlocal food=$1\n\techo \"I like to eat $1 (inside function)\"\n}\nfood=\"scones\"\necho \"I like to eat $food (before function)\"\nlike_to_eat pineapple\necho \"I like to eat $food (after function)\"<\/pre><\/div>\n\n\n\n<p>Our code returns:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>I like to eat scones (before function)\nI like to eat pineapple (inside function)\nI like to eat scones (after function)<\/pre><\/div>\n\n\n\n<p>We have used the variable \u201cfood\u201d to represent the food that we are printing to the console. In our main program, we set the value of \u201cfood\u201d to be equal to \u201cscones\u201d. We then print this food to the console:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>I like to eat scones (before function)<\/pre><\/div>\n\n\n\n<p>Next, we call the like_to_eat function. This function sets the value of \u201cfood\u201d to be whatever value we specify as an argument. In this case, we have specified \u201cpineapple\u201d as an argument. The following is then printed to the console:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>I like to eat pineapple (inside function)<\/pre><\/div>\n\n\n\n<p>The value of \u201cfood\u201d will only change inside the like_to_eat function. That is because it is a local variable.<br><\/p>\n\n\n\n<p>Finally, we print out another message stating the value of \u201cfood\u201d after our like_to_eat function has been called. The value of \u201cfood\u201d is still \u201cscones\u201d. We did change its value inside our function, but we applied the change using a local variable. This means that the value that we changed \u201cfood\u201d to is only accessible in our function.<br><\/p>\n\n\n\n<p>The final statement in our code returns:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>I like to eat scones (after function)<\/pre><\/div>\n\n\n\n<p>This statement is run after our function, but the value of \u201cfood\u201d is still \u201cscones\u201d. That\u2019s because we set the value of \u201cfood\u201d to \u201cscones\u201d as a global variable.<br><\/p>\n\n\n\n<p>You should always try to use local variables within functions. This will help improve the readability and maintainability of your code.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>Functions are blocks of code that perform a particular action within a program. They are useful because they help reduce repetition because you can bundle your code into blocks that can be called multiple times.<br><\/p>\n\n\n\n<p>Now you\u2019re ready to start working with bash functions like an expert developer!<\/p>\n","protected":false},"excerpt":{"rendered":"How to Write a Bash Function A function is a block of code that performs a particular task. Once you have defined a function in a program, it can be reused as many times as you want. Functions are useful because they allow you to reuse code. This enhances the readability of a program. It&hellip;","protected":false},"author":240,"featured_media":14619,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[18070],"tags":[],"class_list":{"0":"post-19275","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-software-engineering-skills"},"acf":{"post_sub_title":"","sprint_id":"","query_class":"Coding","school_sft":"","parent_sft":"","school_privacy_policy":"","has_review":"","is_sponser_post":"","is_guest_post":""},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.0 (Yoast SEO v27.0) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Bash Functions: A Guide | Career Karma<\/title>\n<meta name=\"description\" content=\"A bash function is a block of code that executes a series of commands. On Career Karma, learn how to write and work with bash functions.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/careerkarma.com\/blog\/bash-function\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Bash Functions: A Guide\" \/>\n<meta property=\"og:description\" content=\"A bash function is a block of code that executes a series of commands. On Career Karma, learn how to write and work with bash functions.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/careerkarma.com\/blog\/bash-function\/\" \/>\n<meta property=\"og:site_name\" content=\"Career Karma\" \/>\n<meta property=\"article:publisher\" content=\"http:\/\/facebook.com\/careerkarmaapp\" \/>\n<meta property=\"article:published_time\" content=\"2020-07-10T21:19:15+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-12-01T11:53:29+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/04\/photo-of-person-typing-on-computer-keyboard-735911-2.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1020\" \/>\n\t<meta property=\"og:image:height\" content=\"681\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"James Gallagher\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@career_karma\" \/>\n<meta name=\"twitter:site\" content=\"@career_karma\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"James Gallagher\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/careerkarma.com\/blog\/bash-function\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/bash-function\/\"},\"author\":{\"name\":\"James Gallagher\",\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94\"},\"headline\":\"Bash Functions: A Guide\",\"datePublished\":\"2020-07-10T21:19:15+00:00\",\"dateModified\":\"2023-12-01T11:53:29+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/bash-function\/\"},\"wordCount\":1045,\"commentCount\":0,\"image\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/bash-function\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/04\/photo-of-person-typing-on-computer-keyboard-735911-2.jpg\",\"articleSection\":[\"Software Engineering\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/careerkarma.com\/blog\/bash-function\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/careerkarma.com\/blog\/bash-function\/\",\"url\":\"https:\/\/careerkarma.com\/blog\/bash-function\/\",\"name\":\"Bash Functions: A Guide | Career Karma\",\"isPartOf\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/bash-function\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/bash-function\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/04\/photo-of-person-typing-on-computer-keyboard-735911-2.jpg\",\"datePublished\":\"2020-07-10T21:19:15+00:00\",\"dateModified\":\"2023-12-01T11:53:29+00:00\",\"author\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94\"},\"description\":\"A bash function is a block of code that executes a series of commands. On Career Karma, learn how to write and work with bash functions.\",\"breadcrumb\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/bash-function\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/careerkarma.com\/blog\/bash-function\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/careerkarma.com\/blog\/bash-function\/#primaryimage\",\"url\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/04\/photo-of-person-typing-on-computer-keyboard-735911-2.jpg\",\"contentUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/04\/photo-of-person-typing-on-computer-keyboard-735911-2.jpg\",\"width\":1020,\"height\":681,\"caption\":\"A hand typing on a keyboard\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/careerkarma.com\/blog\/bash-function\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Blog\",\"item\":\"https:\/\/careerkarma.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Software Engineering\",\"item\":\"https:\/\/careerkarma.com\/blog\/software-engineering-skills\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Bash Functions: A Guide\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/careerkarma.com\/blog\/#website\",\"url\":\"https:\/\/careerkarma.com\/blog\/\",\"name\":\"Career Karma\",\"description\":\"Latest Coding Bootcamp News &amp; Career Hacks from Industry Insiders\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/careerkarma.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94\",\"name\":\"James Gallagher\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/01\/james-gallagher-150x150.jpg\",\"contentUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/01\/james-gallagher-150x150.jpg\",\"caption\":\"James Gallagher\"},\"description\":\"James Gallagher is a self-taught programmer and the technical content manager at Career Karma. He has experience in range of programming languages and extensive expertise in Python, HTML, CSS, and JavaScript. James has written hundreds of programming tutorials, and he frequently contributes to publications like Codecademy, Treehouse, Repl.it, Afrotech, and others.\",\"url\":\"https:\/\/careerkarma.com\/blog\/author\/jamesgallagher\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Bash Functions: A Guide | Career Karma","description":"A bash function is a block of code that executes a series of commands. On Career Karma, learn how to write and work with bash functions.","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:\/\/careerkarma.com\/blog\/bash-function\/","og_locale":"en_US","og_type":"article","og_title":"Bash Functions: A Guide","og_description":"A bash function is a block of code that executes a series of commands. On Career Karma, learn how to write and work with bash functions.","og_url":"https:\/\/careerkarma.com\/blog\/bash-function\/","og_site_name":"Career Karma","article_publisher":"http:\/\/facebook.com\/careerkarmaapp","article_published_time":"2020-07-10T21:19:15+00:00","article_modified_time":"2023-12-01T11:53:29+00:00","og_image":[{"width":1020,"height":681,"url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/04\/photo-of-person-typing-on-computer-keyboard-735911-2.jpg","type":"image\/jpeg"}],"author":"James Gallagher","twitter_card":"summary_large_image","twitter_creator":"@career_karma","twitter_site":"@career_karma","twitter_misc":{"Written by":"James Gallagher","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/careerkarma.com\/blog\/bash-function\/#article","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/bash-function\/"},"author":{"name":"James Gallagher","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94"},"headline":"Bash Functions: A Guide","datePublished":"2020-07-10T21:19:15+00:00","dateModified":"2023-12-01T11:53:29+00:00","mainEntityOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/bash-function\/"},"wordCount":1045,"commentCount":0,"image":{"@id":"https:\/\/careerkarma.com\/blog\/bash-function\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/04\/photo-of-person-typing-on-computer-keyboard-735911-2.jpg","articleSection":["Software Engineering"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/careerkarma.com\/blog\/bash-function\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/careerkarma.com\/blog\/bash-function\/","url":"https:\/\/careerkarma.com\/blog\/bash-function\/","name":"Bash Functions: A Guide | Career Karma","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/bash-function\/#primaryimage"},"image":{"@id":"https:\/\/careerkarma.com\/blog\/bash-function\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/04\/photo-of-person-typing-on-computer-keyboard-735911-2.jpg","datePublished":"2020-07-10T21:19:15+00:00","dateModified":"2023-12-01T11:53:29+00:00","author":{"@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94"},"description":"A bash function is a block of code that executes a series of commands. On Career Karma, learn how to write and work with bash functions.","breadcrumb":{"@id":"https:\/\/careerkarma.com\/blog\/bash-function\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/careerkarma.com\/blog\/bash-function\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/careerkarma.com\/blog\/bash-function\/#primaryimage","url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/04\/photo-of-person-typing-on-computer-keyboard-735911-2.jpg","contentUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/04\/photo-of-person-typing-on-computer-keyboard-735911-2.jpg","width":1020,"height":681,"caption":"A hand typing on a keyboard"},{"@type":"BreadcrumbList","@id":"https:\/\/careerkarma.com\/blog\/bash-function\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog","item":"https:\/\/careerkarma.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Software Engineering","item":"https:\/\/careerkarma.com\/blog\/software-engineering-skills\/"},{"@type":"ListItem","position":3,"name":"Bash Functions: A Guide"}]},{"@type":"WebSite","@id":"https:\/\/careerkarma.com\/blog\/#website","url":"https:\/\/careerkarma.com\/blog\/","name":"Career Karma","description":"Latest Coding Bootcamp News &amp; Career Hacks from Industry Insiders","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/careerkarma.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94","name":"James Gallagher","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/01\/james-gallagher-150x150.jpg","contentUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/01\/james-gallagher-150x150.jpg","caption":"James Gallagher"},"description":"James Gallagher is a self-taught programmer and the technical content manager at Career Karma. He has experience in range of programming languages and extensive expertise in Python, HTML, CSS, and JavaScript. James has written hundreds of programming tutorials, and he frequently contributes to publications like Codecademy, Treehouse, Repl.it, Afrotech, and others.","url":"https:\/\/careerkarma.com\/blog\/author\/jamesgallagher\/"}]}},"_links":{"self":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts\/19275","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/users\/240"}],"replies":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/comments?post=19275"}],"version-history":[{"count":0,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts\/19275\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media\/14619"}],"wp:attachment":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media?parent=19275"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/categories?post=19275"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/tags?post=19275"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}