ここで作ったBash scriptをGithubのpublic repositoryにpushしてみますかね?まずは、ブラウザからGitHubへSign InしてWeb UIでレポジトリを作ります。別記事でコマンドラインからレポジトリを作る方法にトライしますかね。ま、WindowsからTeratermでsshしてて、合間でEdgeからGitHubへSignして云々は特に敷居は高くないんだけどね。気分の問題。(RMM的なアプローチ)
まず当該scriptのあるディレクトリへ、
nao@debian-g:~/nhk$ cat rajiru
#!/bin/bash
DATE=`date '+%Y%m%d_%H%M'`
OUTDIR="/mnt/nas/english"
first=$(curl -s "https://www.nhk.or.jp/radio-api/app/v1/web/ondemand/series?site_id=PMMJ59J6N2&corner_site_id=01")
results=$(echo $first | jq '.episodes[].stream_url' | sed -n 5p)
title=$(echo $first | jq '.episodes[].program_title' | sed -n 5p)
temp="${results%\"}"
temp="${temp#\"}"
#echo ${results}
temp2="${title%\"}"
temp2="${temp2#\"}"
echo $temp2
ffmpeg -y -http_seekable 0 -i ${temp} -vn -bsf aac_adtstoasc -acodec copy -metadata title=${temp2} "${OUTDIR}/${temp2}.m4a"
nao@debian-g:~/nhk$ which git
/usr/bin/git
nao@debian-g:~/nhk$ git init
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint:
hint: git config --global init.defaultBranch <name>
hint:
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint:
hint: git branch -m <name>
Initialized empty Git repository in /home/nao/nhk/.git/
文句言われたので、
nao@debian-g:~/nhk$ git config --global init.defaultBranch main
nao@debian-g:~/nhk$ git branch -m main
nao@debian-g:~/nhk$ git add rajiru
nao@debian-g:~/nhk$ git commit -m "rajiru script"
[main (root-commit) ca3c4be] rajiru script
Committer: nao <nao@ghost.mydns.jp>
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly:
git config --global user.name "Your Name"
git config --global user.email you@example.com
After doing this, you may fix the identity used for this commit with:
git commit --amend --reset-author
1 file changed, 18 insertions(+)
create mode 100755 rajiru
せっかくの思し召しなので、一応globalなconfigをしておく
nao@debian-g:~/nhk$ git config --global user.name "Docnao"
nao@debian-g:~/nhk$ git config --global user.email jake.burst@gmail.com
nao@debian-g:~/nhk$ git commit --amend --reset-author
hint: Waiting for your editor to close the file...
ここでedtorが立ち上がったので、commit messageを追加してもよい。
[main 0326806] rajiru script
1 file changed, 18 insertions(+)
create mode 100755 rajiru
nao@debian-g:~/nhk$ git log
commit 03268060222cb585a0936fe03b69ef1a1c5eb2fc (HEAD -> main)
Author: Docnao <jake.burst@gmail.com>
Date: Tue May 20 13:49:28 2025 +0900
rajiru script
Webからだと、
git remote add origin https://github.com/alt-doc-nao/rajiru.git
git branch -M main
git push -u origin main
この通りやってみる。
nao@debian-g:~/nhk$ git push -u origin main
Username for 'https://github.com': alt-doc-nao
Password for 'https://alt-doc-nao@github.com':patを入れればよいがエコーバックされない
Enumerating objects: 3, done.
Counting objects: 100% (3/3), done.
Delta compression using up to 12 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 561 bytes | 561.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
To https://github.com/alt-doc-nao/rajiru.git
* [new branch] main -> main
branch 'main' set up to track 'origin/main'.
とりあえず、pushまでなんとか完了。
文中に書きましたが、git pushの時点で、UsernameとPasswordを聞かれますが、ここで入れるPasswordはSign Inの時のPasswordではなくて、Personal Access Tokenですのでお間違いのないように、環境によってはWindowsの時のように親切なダイアログが出てくるかもしれません。
nao@debian-g:~/nhk$ git status
On branch main
Your branch is up to date with 'origin/main'.
Untracked files:
(use "git add <file>..." to include in what will be committed)
5geturl.sh
5getwtt2.sh
5title.sh
m5geturl.sh
m5getwtt2.sh
nothing added to commit but untracked files present (use "git add" to track)
他のスクリプトはスルーでおけ。目障りならば隠してもおけ。ブラウザでは、

スクリプトを眺めると、

repositoryのurlは、https://github.com/alt-doc-nao/rajiru.gitなので、Windowsだろうが、Debian(Linux)だろうが、
git clone https://github.com/alt-doc-nao/rajiru.git
で取れるはずです。ちなみに今回のDebianは、
nao@debian-g:~$ uname -a
Linux debian-g 6.1.0-33-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.133-1 (2025-04-10) x86_64 GNU/Linux
nao@debian-g:~$ su
パスワード:
root@debian-g:/home/nao# apt update
ヒット:1 http://deb.debian.org/debian bookworm InRelease
取得:2 http://security.debian.org/debian-security bookworm-security InRelease [48.0 kB]
取得:3 http://deb.debian.org/debian bookworm-updates InRelease [55.4 kB]
103 kB を 0秒 で取得しました (223 kB/s)
パッケージリストを読み込んでいます... 完了
依存関係ツリーを作成しています... 完了
状態情報を読み取っています... 完了
アップグレードできるパッケージが XX 個あります。表示するには 'apt list --upgradable' を実行してください。
のようにbookwormでした。
Debian distribution codenames are based on the names of characters from the Toy Story films.
ということになっているのは有名な話ですかね。詳しくは、
を参照のこと。
コメント