Just simple methods to keep the code clean.
Inspired by progrium/bashstyle and Kfir Lavi post.
- All code goes in a function
- Always double quote variables
# Adapted from https://github.com/bennofs/nix-index/blob/master/command-not-found.sh | |
command_not_found_handle () { | |
if [ -n "${MC_SID-}" ] || ! [ -t 1 ]; then | |
>&2 echo "$1: command not found" | |
return 127 | |
fi | |
echo -n "searching nix-index..." | |
ATTRS=$(@nix-locate@ --minimal --no-group --type x --type s --top-level --whole-name --at-root "/bin/$1") |
Just simple methods to keep the code clean.
Inspired by progrium/bashstyle and Kfir Lavi post.
#!/bin/sh | |
# | |
# chkconfig: 2345 55 25 | |
# Description: Nginx init.d script, put in /etc/init.d, chmod +x /etc/init.d/nginx | |
# For Debian, run: update-rc.d -f nginx defaults | |
# For CentOS, run: chkconfig --add nginx | |
# | |
### BEGIN INIT INFO | |
# Provides: nginx | |
# Required-Start: $all |