<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>coffee_kabu</author_name>
  <author_url>https://blog.hatena.ne.jp/coffee_kabu/</author_url>
  <blog_title>Bus errorとSegmentation faultに困ったら見るブログ</blog_title>
  <blog_url>https://coffee-guhaw.hateblo.jp/</blog_url>
  <categories>
    <anon>シェルコマンド/シェルスクリプト</anon>
  </categories>
  <description>自分で作ったplotスクリプトを使っていて、さらなる改良点を見つけてしまったシェルスクリプトの引数の最後のものを取り出す必要があったので、調べてみた#!/bin/sh echo ${@:$#:1}でいけるらしい参考 : 最後のコマンドライン引数を取得する $# は引数の数 $@ はシェルスクリプト実行時、もしくは set コマンド実行時に指定された全パラメータが設定される変数。 $* は基本的には$@と同じだけど、&quot;hoge&quot;みたいな&quot;&quot;で囲んだときの結果が変わるらしい(試してないけど)これらを踏まえて${@:$#:1}${@:2:4}という書き方で、$2から$6までを表示できるらしい、$2か…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fcoffee-guhaw.hateblo.jp%2Fentry%2F2025%2F04%2F11%2F120000&quot; title=&quot;【シェルスクリプト】最後の引数を取り出したいとき - Bus errorとSegmentation faultに困ったら見るブログ&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2025-04-11 12:00:00</published>
  <title>【シェルスクリプト】最後の引数を取り出したいとき</title>
  <type>rich</type>
  <url>https://coffee-guhaw.hateblo.jp/entry/2025/04/11/120000</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
