{"id":34,"date":"2018-10-22T08:00:00","date_gmt":"2018-10-22T00:00:00","guid":{"rendered":""},"modified":"2018-11-11T16:10:58","modified_gmt":"2018-11-11T08:10:58","slug":"the-linux-command-line-errors-and-signals-and-traps-oh-my-part-1","status":"publish","type":"post","link":"https:\/\/yeslq.com\/?p=34","title":{"rendered":"The Linux Command Line&#8212;Errors And Signals And Traps (Oh My!) &#8211; Part 1"},"content":{"rendered":"<h1 style=\"background-color: white; font-family: verdana, arial, helvetica, sans-serif; font-weight: normal;\"><i style=\"font-size: x-small;\"><a href=\"http:\/\/linuxcommand.org\/tlcl.php\" style=\"color: #002740;\">The Linux Command Line&nbsp;<\/a><\/i><span style=\"font-size: xx-small;\">by William Shotts<\/span><\/h1>\n<div><span style=\"font-size: xx-small;\"><br \/><\/span><\/div>\n<div><span style=\"font-size: xx-small;\"><\/p>\n<div style=\"background-color: white; font-family: verdana, arial, helvetica, sans-serif;\">In this lesson, we&#8217;re going to look at handling errors during the execution of your scripts.<\/div>\n<div style=\"background-color: white; font-family: verdana, arial, helvetica, sans-serif;\">The difference between a good program and a poor one is often measured in terms of the program&#8217;s&nbsp;<i>robustness<\/i>. That is, the program&#8217;s ability to handle situations in which something goes wrong.<\/div>\n<h2 style=\"background-color: white; font-family: verdana, arial, helvetica, sans-serif; font-weight: normal;\">Exit Status<\/h2>\n<div style=\"background-color: white; font-family: verdana, arial, helvetica, sans-serif;\">As you recall from previous lessons, every well-written program returns an exit status when it finishes. If a program finishes successfully, the exit status will be zero. If the exit status is anything other than zero, then the program failed in some way.<\/div>\n<div style=\"background-color: white; font-family: verdana, arial, helvetica, sans-serif;\">It is very important to check the exit status of programs you call in your scripts. It is also important that your scripts return a meaningful exit status when they finish. I once had a Unix system administrator who wrote a script for a production system containing the following 2 lines of code:<\/div>\n<div style=\"background-color: #e0e0e0; font-family: verdana, arial, helvetica, sans-serif; padding: 0.5em;\">\n<pre style=\"font-family: courier, lucidatypewriter, monospace;\"><tt style=\"font-family: courier, lucidatypewriter, monospace;\"># Example of a really bad idea<br \/><br \/>cd $some_directory<br \/>rm *<\/tt><\/pre>\n<\/div>\n<div style=\"background-color: white; font-family: verdana, arial, helvetica, sans-serif;\">Why is this such a bad way of doing it? It&#8217;s not, if nothing goes wrong. The two lines change the working directory to the name contained in&nbsp;<tt style=\"font-family: courier, lucidatypewriter, monospace;\">$some_directory<\/tt>and delete the files in that directory. That&#8217;s the intended behavior. But what happens if the directory named in&nbsp;<tt style=\"font-family: courier, lucidatypewriter, monospace;\">$some_directory<\/tt>&nbsp;doesn&#8217;t exist? In that case, the&nbsp;<tt style=\"font-family: courier, lucidatypewriter, monospace;\">cd<\/tt>&nbsp;command will fail and the script executes the&nbsp;<tt style=\"font-family: courier, lucidatypewriter, monospace;\">rm<\/tt>&nbsp;command on the current working directory. Not the intended behavior!<\/div>\n<div style=\"background-color: white; font-family: verdana, arial, helvetica, sans-serif;\">By the way, my hapless system administrator&#8217;s script suffered this very failure and it destroyed a large portion of an important production system. Don&#8217;t let this happen to you!<\/div>\n<div style=\"background-color: white; font-family: verdana, arial, helvetica, sans-serif;\">The problem with the script was that it did not check the exit status of the&nbsp;<tt style=\"font-family: courier, lucidatypewriter, monospace;\">cd<\/tt>&nbsp;command before proceeding with the&nbsp;<tt style=\"font-family: courier, lucidatypewriter, monospace;\">rm<\/tt>&nbsp;command.<\/div>\n<h2 style=\"background-color: white; font-family: verdana, arial, helvetica, sans-serif; font-weight: normal;\">Checking The Exit Status<\/h2>\n<div style=\"background-color: white; font-family: verdana, arial, helvetica, sans-serif;\">There are several ways you can get and respond to the exit status of a program. First, you can examine the contents of the&nbsp;<tt style=\"font-family: courier, lucidatypewriter, monospace;\">$?<\/tt>&nbsp;environment variable.&nbsp;<tt style=\"font-family: courier, lucidatypewriter, monospace;\">$?<\/tt>&nbsp;will contain the exit status of the last command executed. You can see this work with the following:<\/div>\n<div style=\"background-color: black; color: lime; font-family: verdana, arial, helvetica, sans-serif; padding: 0.5em;\">\n<pre style=\"font-family: courier, lucidatypewriter, monospace;\"><tt style=\"font-family: courier, lucidatypewriter, monospace;\">[me] $<\/tt><tt style=\"background: transparent; color: white; font-family: courier, lucidatypewriter, monospace; font-weight: bold;\"> true; echo $?<\/tt><br \/><tt style=\"font-family: courier, lucidatypewriter, monospace;\">0<br \/>[me] $<\/tt> <tt style=\"background: transparent; color: white; font-family: courier, lucidatypewriter, monospace; font-weight: bold;\">false; echo $?<\/tt><br \/><tt style=\"font-family: courier, lucidatypewriter, monospace;\">1<\/tt><\/pre>\n<\/div>\n<div style=\"background-color: white; font-family: verdana, arial, helvetica, sans-serif;\">The&nbsp;<tt style=\"font-family: courier, lucidatypewriter, monospace;\">true<\/tt>&nbsp;and&nbsp;<tt style=\"font-family: courier, lucidatypewriter, monospace;\">false<\/tt>&nbsp;commands are programs that do nothing except return an exit status of zero and one, respectively. Using them, we can see how the&nbsp;<tt style=\"font-family: courier, lucidatypewriter, monospace;\">$?<\/tt>environment variable contains the exit status of the previous program.<\/div>\n<div style=\"background-color: white; font-family: verdana, arial, helvetica, sans-serif;\">So to check the exit status, we could write the script this way:<\/div>\n<div style=\"background-color: #e0e0e0; font-family: verdana, arial, helvetica, sans-serif; padding: 0.5em;\">\n<pre style=\"font-family: courier, lucidatypewriter, monospace;\"><tt style=\"font-family: courier, lucidatypewriter, monospace;\"># Check the exit status<br \/><br \/><tt style=\"font-family: courier, lucidatypewriter, monospace; font-weight: bold;\">cd<\/tt> $some_directory<br \/><tt style=\"font-family: courier, lucidatypewriter, monospace; font-weight: bold;\">if<\/tt> <tt style=\"font-family: courier, lucidatypewriter, monospace; font-weight: bold;\">[<\/tt> \"$?\" = \"0\" <tt style=\"font-family: courier, lucidatypewriter, monospace; font-weight: bold;\">];<\/tt> <tt style=\"font-family: courier, lucidatypewriter, monospace; font-weight: bold;\">then<\/tt><br \/> rm *<br \/><tt style=\"font-family: courier, lucidatypewriter, monospace; font-weight: bold;\">else<\/tt><br \/> <tt style=\"font-family: courier, lucidatypewriter, monospace; font-weight: bold;\">echo<\/tt> \"Cannot change directory!\" 1&gt;&amp;2<br \/> <tt style=\"font-family: courier, lucidatypewriter, monospace; font-weight: bold;\">exit<\/tt> 1<br \/><tt style=\"font-family: courier, lucidatypewriter, monospace; font-weight: bold;\">fi<\/tt><br \/><\/tt><\/pre>\n<\/div>\n<div style=\"background-color: white; font-family: verdana, arial, helvetica, sans-serif;\">In this version, we examine the exit status of the&nbsp;<tt style=\"font-family: courier, lucidatypewriter, monospace;\">cd<\/tt>&nbsp;command and if it&#8217;s not zero, we print an error message on standard error and terminate the script with an exit status of 1.<\/div>\n<div style=\"background-color: white; font-family: verdana, arial, helvetica, sans-serif;\">While this is a working solution to the problem, there are more clever methods that will save us some typing. The next approach we can try is to use the&nbsp;<tt style=\"font-family: courier, lucidatypewriter, monospace;\">if<\/tt>statement directly, since it evaluates the exit status of commands it is given.<\/div>\n<div style=\"background-color: white; font-family: verdana, arial, helvetica, sans-serif;\">Using&nbsp;<tt style=\"font-family: courier, lucidatypewriter, monospace;\">if<\/tt>, we could write it this way:<\/div>\n<div style=\"background-color: #e0e0e0; font-family: verdana, arial, helvetica, sans-serif; padding: 0.5em;\">\n<pre style=\"font-family: courier, lucidatypewriter, monospace;\"><tt style=\"font-family: courier, lucidatypewriter, monospace;\"># A better way<br \/><br \/><tt style=\"font-family: courier, lucidatypewriter, monospace; font-weight: bold;\">if<\/tt> <tt style=\"font-family: courier, lucidatypewriter, monospace; font-weight: bold;\">cd<\/tt> $some_directory; <tt style=\"font-family: courier, lucidatypewriter, monospace; font-weight: bold;\">then<\/tt><br \/> rm *<br \/><tt style=\"font-family: courier, lucidatypewriter, monospace; font-weight: bold;\">else<\/tt><br \/> <tt style=\"font-family: courier, lucidatypewriter, monospace; font-weight: bold;\">echo<\/tt> \"Could not change directory! Aborting.\" 1&gt;&amp;2<br \/> <tt style=\"font-family: courier, lucidatypewriter, monospace; font-weight: bold;\">exit<\/tt> 1<br \/><tt style=\"font-family: courier, lucidatypewriter, monospace; font-weight: bold;\">fi<\/tt><br \/><\/tt><\/pre>\n<\/div>\n<div style=\"background-color: white; font-family: verdana, arial, helvetica, sans-serif;\">Here we check to see if the&nbsp;<tt style=\"font-family: courier, lucidatypewriter, monospace;\">cd<\/tt>&nbsp;command is successful. Only then does&nbsp;<tt style=\"font-family: courier, lucidatypewriter, monospace;\">rm<\/tt>&nbsp;get executed; otherwise an error message is output and the program exits with a code of 1, indicating that an error has occurred.<\/div>\n<h2 style=\"background-color: white; font-family: verdana, arial, helvetica, sans-serif; font-weight: normal;\">An Error Exit Function<\/h2>\n<div style=\"background-color: white; font-family: verdana, arial, helvetica, sans-serif;\">Since we will be checking for errors often in our programs, it makes sense to write a function that will display error messages. This will save more typing and promote laziness.<\/div>\n<div style=\"background-color: #e0e0e0; font-family: verdana, arial, helvetica, sans-serif; padding: 0.5em;\">\n<pre style=\"font-family: courier, lucidatypewriter, monospace;\"><tt style=\"font-family: courier, lucidatypewriter, monospace;\"># An error exit function<br \/><br \/>error_exit()<br \/>{<br \/> <tt style=\"font-family: courier, lucidatypewriter, monospace; font-weight: bold;\">echo<\/tt> \"$1\" 1&gt;&amp;2<br \/> <tt style=\"font-family: courier, lucidatypewriter, monospace; font-weight: bold;\">exit<\/tt> 1<br \/>}<br \/><br \/># Using error_exit<br \/><br \/><tt style=\"font-family: courier, lucidatypewriter, monospace; font-weight: bold;\">if<\/tt> <tt style=\"font-family: courier, lucidatypewriter, monospace; font-weight: bold;\">cd<\/tt> $some_directory; <tt style=\"font-family: courier, lucidatypewriter, monospace; font-weight: bold;\">then<\/tt><br \/> rm *<br \/><tt style=\"font-family: courier, lucidatypewriter, monospace; font-weight: bold;\">else<\/tt><br \/> error_exit \"Cannot change directory!  Aborting.\"<br \/><tt style=\"font-family: courier, lucidatypewriter, monospace; font-weight: bold;\">fi<\/tt><br \/><\/tt><\/pre>\n<\/div>\n<h2 style=\"background-color: white; font-family: verdana, arial, helvetica, sans-serif; font-weight: normal;\">AND And OR Lists<\/h2>\n<div style=\"background-color: white; font-family: verdana, arial, helvetica, sans-serif;\">Finally, we can further simplify our script by using the AND and OR control operators. To explain how they work, I will quote from the&nbsp;<tt style=\"font-family: courier, lucidatypewriter, monospace; font-weight: bold;\"><a href=\"http:\/\/linuxcommand.org\/man_pages\/bash1.html\" style=\"color: #002740;\">bash<\/a><\/tt>&nbsp;man page:<\/div>\n<div style=\"background-color: white; font-family: verdana, arial, helvetica, sans-serif;\">&#8220;The control operators &amp;&amp; and || denote AND lists and OR lists, respectively. An AND list has the form<\/div>\n<div style=\"background-color: #e0e0e0; font-family: verdana, arial, helvetica, sans-serif; padding: 0.5em;\"><tt style=\"font-family: courier, lucidatypewriter, monospace;\">command1 &amp;&amp; command2<\/tt><\/div>\n<div style=\"background-color: white; font-family: verdana, arial, helvetica, sans-serif;\"><tt style=\"font-family: courier, lucidatypewriter, monospace;\">command2<\/tt>&nbsp;is executed if,&nbsp;<i>and only if<\/i>,&nbsp;<tt style=\"font-family: courier, lucidatypewriter, monospace;\">command1<\/tt>&nbsp;returns an exit status of zero.<\/div>\n<div style=\"background-color: white; font-family: verdana, arial, helvetica, sans-serif;\">An OR list has the form<\/div>\n<div style=\"background-color: #e0e0e0; font-family: verdana, arial, helvetica, sans-serif; padding: 0.5em;\"><tt style=\"font-family: courier, lucidatypewriter, monospace;\">command1 || command2<\/tt><\/div>\n<div style=\"background-color: white; font-family: verdana, arial, helvetica, sans-serif;\"><tt style=\"font-family: courier, lucidatypewriter, monospace;\">command2<\/tt>&nbsp;is executed if, and only if,&nbsp;<tt style=\"font-family: courier, lucidatypewriter, monospace;\">command1<\/tt>&nbsp;returns a non-zero exit status. The exit status of AND and OR lists is the exit status of the last command executed in the list.&#8221;<\/div>\n<div style=\"background-color: white; font-family: verdana, arial, helvetica, sans-serif;\">Again, we can use the&nbsp;<tt style=\"font-family: courier, lucidatypewriter, monospace;\">true<\/tt>&nbsp;and&nbsp;<tt style=\"font-family: courier, lucidatypewriter, monospace;\">false<\/tt>&nbsp;commands to see this work:<\/div>\n<div style=\"background-color: black; color: lime; font-family: verdana, arial, helvetica, sans-serif; padding: 0.5em;\">\n<pre style=\"font-family: courier, lucidatypewriter, monospace;\"><tt style=\"font-family: courier, lucidatypewriter, monospace;\"><tt style=\"font-family: courier, lucidatypewriter, monospace;\">[me] $<\/tt> <tt style=\"background: transparent; color: white; font-family: courier, lucidatypewriter, monospace; font-weight: bold;\">true || echo \"echo executed\"<\/tt><br \/><tt style=\"font-family: courier, lucidatypewriter, monospace;\">[me] $<\/tt> <tt style=\"background: transparent; color: white; font-family: courier, lucidatypewriter, monospace; font-weight: bold;\">false || echo \"echo executed\"<\/tt><br \/><tt style=\"font-family: courier, lucidatypewriter, monospace;\">echo executed<\/tt><br \/><tt style=\"font-family: courier, lucidatypewriter, monospace;\">[me] $<\/tt> <tt style=\"background: transparent; color: white; font-family: courier, lucidatypewriter, monospace; font-weight: bold;\">true &amp;&amp; echo \"echo executed\"<\/tt><br \/><tt style=\"font-family: courier, lucidatypewriter, monospace;\">echo executed<\/tt><br \/><tt style=\"font-family: courier, lucidatypewriter, monospace;\">[me] $<\/tt> <tt style=\"background: transparent; color: white; font-family: courier, lucidatypewriter, monospace; font-weight: bold;\">false &amp;&amp; echo \"echo executed\"<\/tt><br \/><tt style=\"font-family: courier, lucidatypewriter, monospace;\">[me] $<\/tt><\/tt><\/pre>\n<\/div>\n<div style=\"background-color: white; font-family: verdana, arial, helvetica, sans-serif;\">Using this technique, we can write an even simpler version:<\/div>\n<div style=\"background-color: #e0e0e0; font-family: verdana, arial, helvetica, sans-serif; padding: 0.5em;\">\n<pre style=\"font-family: courier, lucidatypewriter, monospace;\"><tt style=\"font-family: courier, lucidatypewriter, monospace;\"># Simplest of all<br \/><br \/><tt style=\"font-family: courier, lucidatypewriter, monospace; font-weight: bold;\">cd<\/tt> $some_directory || error_exit \"Cannot change directory! Aborting\"<br \/>rm *<br \/><\/tt><\/pre>\n<\/div>\n<div style=\"background-color: white; font-family: verdana, arial, helvetica, sans-serif;\">If an exit is not required in case of error, then you can even do this:<\/div>\n<div style=\"background-color: #e0e0e0; font-family: verdana, arial, helvetica, sans-serif; padding: 0.5em;\">\n<pre style=\"font-family: courier, lucidatypewriter, monospace;\"><tt style=\"font-family: courier, lucidatypewriter, monospace;\"># Another way to do it if exiting is not desired<br \/><br \/><tt style=\"font-family: courier, lucidatypewriter, monospace; font-weight: bold;\">cd<\/tt> $some_directory &amp;&amp; rm *<br \/><\/tt><\/pre>\n<\/div>\n<div style=\"background-color: white; font-family: verdana, arial, helvetica, sans-serif;\">I want to point out that even with the defense against errors we have introduced in our example for the use of&nbsp;<tt style=\"font-family: courier, lucidatypewriter, monospace;\">cd<\/tt>, this code is still vulnerable to a common programming error, namely, what happens if the name of the variable containing the name of the directory is misspelled? In that case, the shell will interpret the variable as empty and the&nbsp;<tt style=\"font-family: courier, lucidatypewriter, monospace;\">cd<\/tt>&nbsp;succeed, but it will change directories to the user&#8217;s home directory, so beware!<\/div>\n<h2 style=\"background-color: white; font-family: verdana, arial, helvetica, sans-serif; font-weight: normal;\">Improving The Error Exit Function<\/h2>\n<div style=\"background-color: white; font-family: verdana, arial, helvetica, sans-serif;\">There are a number of improvements that we can make to the&nbsp;<tt style=\"font-family: courier, lucidatypewriter, monospace;\">error_exit<\/tt>&nbsp;function. I like to include the name of the program in the error message to make clear where the error is coming from. This becomes more important as your programs get more complex and you start having scripts launching other scripts, etc. Also, note the inclusion of the&nbsp;<tt style=\"font-family: courier, lucidatypewriter, monospace;\">LINENO<\/tt>&nbsp;environment variable which will help you identify the exact line within your script where the error occurred.<\/div>\n<div style=\"background-color: #e0e0e0; font-family: verdana, arial, helvetica, sans-serif; padding: 0.5em;\">\n<pre style=\"font-family: courier, lucidatypewriter, monospace;\"><tt style=\"font-family: courier, lucidatypewriter, monospace;\">#!\/bin\/bash<br \/><br \/># A slicker error handling routine<br \/><br \/># I put a variable in my scripts named PROGNAME which<br \/># holds the name of the program being run.  You can get this<br \/># value from the first item on the command line ($0).<br \/><br \/>PROGNAME=$(basename $0)<br \/><br \/>error_exit()<br \/>{<br \/><br \/># ----------------------------------------------------------------<br \/># Function for exit due to fatal program error<br \/>#  Accepts 1 argument:<br \/>#   string containing descriptive error message<br \/># ----------------------------------------------------------------<br \/><br \/><br \/> <tt style=\"font-family: courier, lucidatypewriter, monospace; font-weight: bold;\">echo<\/tt> \"${PROGNAME}: ${1:-\"Unknown Error\"}\" 1&gt;&amp;2<br \/> <tt style=\"font-family: courier, lucidatypewriter, monospace; font-weight: bold;\">exit<\/tt> 1<br \/>}<br \/><br \/># Example call of the error_exit function.  Note the inclusion<br \/># of the LINENO environment variable.  It contains the current<br \/># line number.<br \/><br \/><tt style=\"font-family: courier, lucidatypewriter, monospace; font-weight: bold;\">echo<\/tt> \"Example of error with line number and message\"<br \/>error_exit \"$LINENO: An error has occurred.\"<br \/><\/tt><\/pre>\n<\/div>\n<div style=\"background-color: white; font-family: verdana, arial, helvetica, sans-serif;\">The use of the curly braces within the&nbsp;<tt style=\"font-family: courier, lucidatypewriter, monospace;\">error_exit<\/tt>&nbsp;function is an example of&nbsp;<i>parameter expansion<\/i>. You can surround a variable name with curly braces (as with&nbsp;<tt style=\"font-family: courier, lucidatypewriter, monospace;\">${PROGNAME}<\/tt>) if you need to be sure it is separated from surrounding text. Some people just put them around every variable out of habit. That usage is simply a style thing. The second use,&nbsp;<tt style=\"font-family: courier, lucidatypewriter, monospace;\">${1:-\"Unknown Error\"}<\/tt>&nbsp;means that if parameter 1 (<tt style=\"font-family: courier, lucidatypewriter, monospace;\">$1<\/tt>) is undefined, substitute the string &#8220;Unknown Error&#8221; in its place. Using parameter expansion, it is possible to perform a number of useful string manipulations. You can read more about parameter expansion in the&nbsp;<tt style=\"font-family: courier, lucidatypewriter, monospace; font-weight: bold;\"><a href=\"http:\/\/linuxcommand.org\/lc3_man_pages\/bash1.html\" style=\"color: #002740;\">bash<\/a><\/tt>&nbsp;man page under the topic &#8220;EXPANSIONS&#8221;.<\/div>\n<div style=\"background-color: white; font-family: verdana, arial, helvetica, sans-serif; padding: 1em;\"><\/div>\n<p><\/span><\/div>\n","protected":false},"excerpt":{"rendered":"<p>The Linux Command Line&nbsp;by William Shotts In this l &#8230; <a title=\"The Linux Command Line&#8212;Errors And Signals And Traps (Oh My!) &#8211; Part 1\" class=\"read-more\" href=\"https:\/\/yeslq.com\/?p=34\" aria-label=\"\u9605\u8bfb The Linux Command Line&#8212;Errors And Signals And Traps (Oh My!) &#8211; Part 1\">\u9605\u8bfb\u66f4\u591a<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,3,4,6],"tags":[],"class_list":["post-34","post","type-post","status-publish","format-standard","hentry","category-error","category-linux","category-shell","category-the-linux-command-line"],"_links":{"self":[{"href":"https:\/\/yeslq.com\/index.php?rest_route=\/wp\/v2\/posts\/34","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/yeslq.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/yeslq.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/yeslq.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/yeslq.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=34"}],"version-history":[{"count":1,"href":"https:\/\/yeslq.com\/index.php?rest_route=\/wp\/v2\/posts\/34\/revisions"}],"predecessor-version":[{"id":95,"href":"https:\/\/yeslq.com\/index.php?rest_route=\/wp\/v2\/posts\/34\/revisions\/95"}],"wp:attachment":[{"href":"https:\/\/yeslq.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=34"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/yeslq.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=34"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/yeslq.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=34"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}