{"id":25805,"date":"2024-07-31T02:41:16","date_gmt":"2024-07-30T19:41:16","guid":{"rendered":"https:\/\/dte.telkomuniversity.ac.id\/?p=25805"},"modified":"2024-07-31T02:41:18","modified_gmt":"2024-07-30T19:41:18","slug":"menampilkan-ekspansi-shell","status":"publish","type":"post","link":"https:\/\/dte.telkomuniversity.ac.id\/en\/menampilkan-ekspansi-shell\/","title":{"rendered":"Menampilkan Ekspansi Shell"},"content":{"rendered":"\n<p>Saat perintah dimasukkan di baris perintah, perintah tersebut diperluas menjadi outputnya yang ditampilkan. Ini disebut ekspansi.<\/p>\n\n\n\n<p>Perintah yang Anda ketik akan dicetak dengan bantuan perintah <code>echo<\/code> di terminal. Perintah ini akan berguna ketika Anda ingin memeriksa apa yang dilakukan perintah Anda di shell.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Perintah dan Fungsi<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Perintah<\/th><th>Fungsi<\/th><\/tr><\/thead><tbody><tr><td><code>set -x<\/code><\/td><td>Digunakan untuk mengaktifkan tampilan ekspansi shell.<\/td><\/tr><tr><td><code>set +x<\/code><\/td><td>Digunakan untuk menonaktifkan tampilan ekspansi shell.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><code>set -x<\/code><\/h3>\n\n\n\n<p>Perintah <code>set -x<\/code> mengaktifkan tampilan perintah shell.<\/p>\n\n\n\n<p><strong>Sintaks:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">arduinoSalin kode<code>echo &lt;text&gt;\n<\/code><\/pre>\n\n\n\n<p><strong>Contoh:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">bashSalin kode<code>echo $USER\necho \\$USER\n<\/code><\/pre>\n\n\n\n<p>Pada contoh di atas, <code>set -x<\/code> menampilkan ekspansi shell di terminal. Anda dapat melihat apa yang dilakukan shell dengan perintah yang diberikan. Dengan perintah <code>echo $USER<\/code>, ekspansi shell menunjukkan bahwa <code>$USER<\/code> diubah menjadi &#8216;sssit&#8217;.<\/p>\n\n\n\n<p>Dengan perintah <code>echo \\$USER<\/code>, ekspansi shell menunjukkan bahwa karena karakter khusus backslash (), <code>$USER<\/code> tidak diubah menjadi &#8216;sssit&#8217;.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><code>set +x<\/code><\/h3>\n\n\n\n<p>Perintah <code>set +x<\/code> menonaktifkan tampilan perintah shell.<\/p>\n\n\n\n<p><strong>Sintaks:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">arduinoSalin kode<code>echo &lt;text&gt;\n<\/code><\/pre>\n\n\n\n<p><strong>Contoh:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">bashSalin kode<code>echo $USER\necho \\$USER\n<\/code><\/pre>\n\n\n\n<p>Pada contoh di atas, ekspansi shell dinonaktifkan sehingga output dicetak langsung di terminal.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>ref: [1]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Saat perintah dimasukkan di baris perintah, perintah tersebut diperluas menjadi outputnya yang ditampilkan. Ini disebut ekspansi. Perintah yang Anda ketik akan dicetak dengan bantuan perintah echo di terminal. Perintah ini akan berguna ketika Anda ingin memeriksa apa yang dilakukan perintah Anda di shell. Perintah dan Fungsi Perintah Fungsi set -x Digunakan untuk mengaktifkan tampilan ekspansi [&hellip;]<\/p>\n","protected":false},"author":25,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"wds_primary_category":0,"footnotes":""},"categories":[753],"tags":[179],"class_list":["post-25805","post","type-post","status-publish","format-standard","hentry","category-linux","tag-linux"],"_links":{"self":[{"href":"https:\/\/dte.telkomuniversity.ac.id\/en\/wp-json\/wp\/v2\/posts\/25805","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dte.telkomuniversity.ac.id\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dte.telkomuniversity.ac.id\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dte.telkomuniversity.ac.id\/en\/wp-json\/wp\/v2\/users\/25"}],"replies":[{"embeddable":true,"href":"https:\/\/dte.telkomuniversity.ac.id\/en\/wp-json\/wp\/v2\/comments?post=25805"}],"version-history":[{"count":1,"href":"https:\/\/dte.telkomuniversity.ac.id\/en\/wp-json\/wp\/v2\/posts\/25805\/revisions"}],"predecessor-version":[{"id":25806,"href":"https:\/\/dte.telkomuniversity.ac.id\/en\/wp-json\/wp\/v2\/posts\/25805\/revisions\/25806"}],"wp:attachment":[{"href":"https:\/\/dte.telkomuniversity.ac.id\/en\/wp-json\/wp\/v2\/media?parent=25805"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dte.telkomuniversity.ac.id\/en\/wp-json\/wp\/v2\/categories?post=25805"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dte.telkomuniversity.ac.id\/en\/wp-json\/wp\/v2\/tags?post=25805"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}