Add quoting

Command variables and some other variable uses are not quoted, which would break things if one of them contains spaces or other field separators. This commit fixes this by quoting every variable use.