)]}'
{"doc/saio/bin/resetswift":[{"author":{"_account_id":1179,"name":"Clay Gerrard","email":"clay.gerrard@gmail.com","username":"clay-gerrard"},"change_message_id":"f1ca4ed452a12e56f12a52685ef92fd00a5a9cc1","unresolved":false,"context_lines":[{"line_number":15,"context_line":"         /srv/4/node/sdb4 /srv/4/node/sdb8"},{"line_number":16,"context_line":"sudo rm -f /var/log/debug /var/log/messages /var/log/rsyncd.log /var/log/syslog"},{"line_number":17,"context_line":"find /var/cache/swift* -type f -name *.recon -exec rm -f {} \\;"},{"line_number":18,"context_line":"if [ -x \"$(command -v systemctl)\" ]; then"},{"line_number":19,"context_line":"    sudo systemctl restart rsyslog"},{"line_number":20,"context_line":"    sudo systemctl restart memcached"},{"line_number":21,"context_line":"else"}],"source_content_type":"application/x-shellscript","patch_set":1,"id":"7a2fa921_7413440e","line":18,"updated":"2015-10-12 20:14:26.000000000","message":"maybe you\u0027ve bash foo is a higher level than mine, but after consulting SHELL BUILTIN COMMANDS it\u0027s not obvious to me why this is better than `which`?\n\ne.g.\n\n    $ alias systemctl\u003d\"service\"\n    $ command -v systemctl\n    alias systemctl\u003d\u0027service\u0027\n    $ echo $?\n    0\n    $ systemctl rsyslog status\n    rsyslog start/running, process 18879\n\nAn alias like this (which hopefully(?) no one would have) leads to an interesting failure mode later when the sudo tries to use the alias which was erroneously detected with `command -v` and finds no such alias defined in the sub-shell.\n\nAgain, no bash expert here, but IMHO, something like this would seem more idiomatic:\n\n    if $(which systemctl \u003e /dev/null); then \n        echo found it\n    else\n        echo not found it\n    fi\n\nI\u0027d be curious if you have some insight that would prefer the use of the `command` builtin; it\u0027d be a learning opportunity for me.  Perhaps because it\u0027s a builtin and coreutils may not be installed (!?); in that case maybe \n\n  if [ `type -t systemctl` \u003d\u003d \"file\" ]; then\n\n???","commit_id":"e9f3a052638c107972f79781cc0c9f23d7152a0f"},{"author":{"_account_id":16896,"name":"Ondřej Nový","email":"novy@ondrej.org","username":"onovy"},"change_message_id":"0f78d218d85ab979f99cd28f33ae2795a4ee320a","unresolved":false,"context_lines":[{"line_number":15,"context_line":"         /srv/4/node/sdb4 /srv/4/node/sdb8"},{"line_number":16,"context_line":"sudo rm -f /var/log/debug /var/log/messages /var/log/rsyncd.log /var/log/syslog"},{"line_number":17,"context_line":"find /var/cache/swift* -type f -name *.recon -exec rm -f {} \\;"},{"line_number":18,"context_line":"if [ -x \"$(command -v systemctl)\" ]; then"},{"line_number":19,"context_line":"    sudo systemctl restart rsyslog"},{"line_number":20,"context_line":"    sudo systemctl restart memcached"},{"line_number":21,"context_line":"else"}],"source_content_type":"application/x-shellscript","patch_set":1,"id":"7a2fa921_01ac0dec","line":18,"in_reply_to":"7a2fa921_7413440e","updated":"2015-10-12 20:41:34.000000000","message":"\"command\" is most portable and compatible with POSIX. \"which\" is external command.\n\ni followed this:\nhttp://stackoverflow.com/questions/592620/check-if-a-program-exists-from-a-bash-script\n\nthat type seems to working fine.","commit_id":"e9f3a052638c107972f79781cc0c9f23d7152a0f"}]}
