Last active
January 5, 2017 02:41
-
-
Save nekoruri/6290799 to your computer and use it in GitHub Desktop.
よく使いそうなbash関数
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
# DEBUG付いてるときだけデバッグ出力 | |
function debug() { ((DEBUG)) && echo "$*"; } | |
# タイムスタンプ付き出力 | |
function ts() { echo $(date +'%Y/%m/%d %H:%M:%S')" $1"; } | |
# タイムスタンプ付きデバッグ出力 | |
function debugts() { debug $(date +'%Y/%m/%d %H:%M:%S')" $1"; } | |
# ディレクトリの絶対パス | |
# 文字列を表示して返すので basedir=$(absdirname $0) とかやって使う。 | |
function absdirname() { echo $(readlink -f $(dirname $1)) } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment