Created
May 24, 2017 12:38
-
-
Save musaprg/f16e282d059f155b662bf14a6388668a to your computer and use it in GitHub Desktop.
一番新しいファイルを表示する
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# 古い演算結果が残ってたら削除 | |
# -e で存在するか否かを返してくれる | |
if [ -e result.csv ]; then | |
rm result.csv | |
fi | |
# ls -t でタイムスタンプ順に新しいものからソートしてくれる | |
# set -- <hoge>でタブor空白ごとにsplitして$n(n=1,2,...)に格納してくれる | |
set -- `ls -t ./results` | |
echo $1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
例えば演算結果をresultsディレクトリ内に格納しておいて,その中から最新のものを使って最終結果ファイルをresult.csvとして出力するときとかに使えるね!便利だねすごい!