0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【備忘録】povoの利用停止日表示bashスクリプト

Posted at

はじめに

povoの利用停止日が、有効期限日の翌日から180日(有効期限日から181日)のため、現在持っている回線の利用停止日を表示するbashスクリプトを書いたので掲載

下準備

テキストファイルに以下の形式で記録
複数回線ある場合は行を分けて記載
回線名は適当で大丈夫ですが、日付は必ず最後に購入したトッピングの有効期限日を記載

povodate.txt
回線1,2025-01-22
回線2,2025-07-14

スクリプト

povo.sh
#!/bin/bash                      
TODAY=$(date -d $(date +%Y-%m-%d) +%s)                     
#利用停止日が有効期限日から181日
POVO=181
POVODATA="povodate.txt"
echo "povo利用停止日"
while read DATA
do
MAC=$(echo $DATA | awk -F "," '{print $1}') 
BUYDAY=$(echo $DATA | awk -F "," '{print $2}') 
echo "$(printf "%-9s" "$MAC"):残り$(printf "%3d" $(($POVO-$(($(($TODAY - $(date -d "$BUYDAY" +%s))) / $((60*60*24)))))))$(date -d @$(($(($POVO*60*60*24)) + $(date -d $BUYDAY +%s))) +%Y-%m-%d)まで ($BUYDAY期限切れ)"                   
done < $POVODATA

実行

'povodate.txt'と'povo.sh'を同一ディレクトリに格納し実行

0
0
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?