pidof コマンドを使う (稼働中のプロセスIDを返す)
||で繋げてコマンド実行すればOK/proc/$$/commあたりと同じ動作なので、スクリプトの場合bashが入ってしまうpidof -x fooのように-xを入れるとスクリプトは対応できる
| ^+a:: | |
| IfWinExist PuTTY | |
| WinActivate | |
| Else | |
| Run,C:\Users\kazunori.nishi\app\putty-0.70-jp20170713\puttyjp.exe | |
| return | |
| ^+b:: | |
| Process,Exist,chrome.exe |
| /* npm install acorn acorn-walk */ | |
| /* usage: nodejs print-func.js foo.js --call */ | |
| let mode = 'name'; | |
| let index = process.argv.findIndex(function(e) { return e == "--call"}); | |
| if (index > 0) { process.argv.splice(index, 1); mode = 'call'; } | |
| let filename = process.argv[2]; | |
| if (!filename) throw "file not found"; |
$ curl -H 'Accept-Encoding: gzip' http://staff.livedoor.blog/ > x1
$ crystal test.cr > x2
$ LC_ALL=C ls -l x1 x2
-rw-rw-r-- 1 maiha maiha 13786 Feb 10 10:00 x1
-rw-rw-r-- 1 maiha maiha 13602 Feb 10 10:06 x2
$ file x1 x2
x1: gzip compressed data, last modified: Sun Feb 10 01:00:48 2019, from Unixapt update
apt upgrade
apt dist-upgrade
apt autoremove
do-release-upgrade
# +00:01 [RETURN]
# +00:04 y