2025/07/20

スマホのターミナルエミュレータ

 スマホにtermuxというターミナルエミュレータを導入して、キャラクターインターフェースが使えるようにした。viやbashなどが動く。これで、Ubuntuで作成したbashscriptが動かせるようになった。
 折畳みできてブルートゥースで使えるキーボード(Ewinという製品)を購入したので、スマホとこのキーボードでメインPCのUbuntuと同様の作業環境を手軽に持ち歩けるようになり、スマホの活用範囲が拡大された。
 これでmusescoreが動けば万々歳なのだが、アンドロイド版の無料のmusescoreは楽譜の閲覧と再生しかできない。楽譜の作成・編集ができるのはmusescoreProでこれは有料だ。楽譜の作成・編集ができるPC版のmusescoreは無料なのだが。

 100円ショップに華奢でそのままカバンなどに入れて持ち運ぶのがやや心配だった折畳みキーボードがぴったり入るケースがあった。中に一つ仕切りがあったがそれを切り取ったら誂えたように厚みまでぴったり。これで持ち歩きも安心だ。

    $HOME=/data/data/com.termux/files/home
    $HOME―+―.bashrc
           |―.config
           |―.ssh
           |―.suroot
           |―.vim
           |―.vimrc
           |―.viminfo
           |―bsh―+―addr
           |       |―addr.bsh
           |       |―age
           |       |―age.bsh
           |       |―nn
           |       |―nn.bsh
           |       |―vwwu
           |       |―vwwu.bsh
           |       |―w
           |       |―w.bsh
           |       |―addr_u.txt
           |       |―nengo.txt
           |       |―tohtm.utf
           |       +―tohtm
           |
           +―storage―+―audiobooks―+
                       |―media-0―+
                       |―movies―+
                       |―dcim―+
                       |―music―+
                       |―documents―+
                       |―pictures―+
                       |―donloads―+
                       |―podcasts―+
                       |―external-0―+
                       +―shared―+
   

# addr.bsh(addr)
echo --------------------
if [ $# -eq 0 ]; then echo 'no arg';
elif [ $# -eq 1 ]; then  grep "${1}" ~/bsh/addr_u.txt | sed -e /^#/d;
elif [ $# -eq 2 ]; then  grep "${1}" ~/bsh/addr_u.txt | grep "${2}" | sed -e /^#/d;
else echo 'too many args';
fi
echo --------------------
   

# age.bsh(age)
if [ $# -eq 0 ]; then echo 'no arg';                                            
elif [ $# -eq 1 ]; then Y0=`grep "$1" ~/bsh/nengo.txt`; Y1=(${Y0// / }); Y2="${Y1[1]}"; Y3=`date +'%Y'`; echo "age= $((Y3-Y2))";
elif [ $# -gt 1 ]; then echo 'too many args';
fi
   

# nn.bsh(nn)
if [ $# -eq 0 ]; then echo 'no arg';                                            
elif [ $# -eq 1 ]; then grep "$1" ~/bsh/nengo.txt;
elif [ $# -eq 2 ]; then grep "$1" ~/bsh/nengo.txt | grep "$2";
else [ $# -gt 2 ]; echo 'too many args';
fi
   

# w.bsh(w)
Y=`date +'%Y'`; MD=`date +'%m/%d'`;                                             
if [ $# -eq 0 ]; then grep "$MD" ~/storage/downloads/wl"$Y".txt;
elif [ $# -eq 1 ]; then grep "$1" ~/storage/downloads/wl"$Y".txt;
elif [ $# -eq 2 ]; then grep "$1" ~/storage/downloads/wl"$2".txt;
else echo 'too many args';
fi
   

# vwwu.bsh(vwwu)
# tohtm.utf